Disallow more than 77 fractional digits.

This commit is contained in:
chriseth
2021-10-06 13:55:38 +02:00
parent 96d50431bb
commit 3fe4b0b2c3
9 changed files with 15 additions and 15 deletions
@@ -1,7 +1,7 @@
contract test {
function f() public {
ufixed256x18 a = ufixed256x18(1/3); a;
ufixed248x18 b = ufixed248x18(1/3); b;
ufixed256x77 a = ufixed256x77(1/3); a;
ufixed248x77 b = ufixed248x77(1/3); b;
ufixed8x1 c = ufixed8x1(1/3); c;
}
}
@@ -9,9 +9,9 @@ contract C {
bytes payable h;
bytes32 payable i;
fixed payable j;
fixed80x80 payable k;
fixed80x77 payable k;
ufixed payable l;
ufixed80x80 payable m;
ufixed80x77 payable m;
}
// ----
// ParserError 9106: (22-29): State mutability can only be specified for address types.
@@ -9,9 +9,9 @@ contract C {
function h(bytes payable) public pure {}
function i(bytes32 payable) public pure {}
function j(fixed payable) public pure {}
function k(fixed80x80 payable) public pure {}
function k(fixed80x77 payable) public pure {}
function l(ufixed payable) public pure {}
function m(ufixed80x80 payable) public pure {}
function m(ufixed80x77 payable) public pure {}
}
// ----
// ParserError 9106: (33-40): State mutability can only be specified for address types.
@@ -10,9 +10,9 @@ contract C {
bytes payable h;
bytes32 payable i;
fixed payable j;
fixed80x80 payable k;
fixed80x77 payable k;
ufixed payable l;
ufixed80x80 payable m;
ufixed80x77 payable m;
}
}
// ----
@@ -9,9 +9,9 @@ contract C {
function h() public pure returns (bytes payable) {}
function i() public pure returns (bytes32 payable) {}
function j() public pure returns (fixed payable) {}
function k() public pure returns (fixed80x80 payable) {}
function k() public pure returns (fixed80x77 payable) {}
function l() public pure returns (ufixed payable) {}
function m() public pure returns (ufixed80x80 payable) {}
function m() public pure returns (ufixed80x77 payable) {}
}
// ----
// ParserError 9106: (56-63): State mutability can only be specified for address types.
@@ -1,5 +1,5 @@
contract C {
fixed8x80 a = -1e-100;
fixed8x77 a = -1e-100;
}
// ----
// TypeError 7407: (29-36): Type rational_const -1 / 1000...(93 digits omitted)...0000 is not implicitly convertible to expected type fixed8x80. Conversion incurs precision loss. Use an explicit conversion instead.
// TypeError 7407: (29-36): Type rational_const -1 / 1000...(93 digits omitted)...0000 is not implicitly convertible to expected type fixed8x77. Conversion incurs precision loss. Use an explicit conversion instead.