mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test cases
This commit is contained in:
parent
d6fcb36c4d
commit
8adf89f042
@ -967,6 +967,49 @@ BOOST_AUTO_TEST_CASE(modifiers)
|
||||
checkCallGraphExpectations(get<1>(graphs), expectedDeployedEdges, expectedCreatedContractsAfterDeployment);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(literal_suffixes)
|
||||
{
|
||||
unique_ptr<CompilerStack> compilerStack = parseAndAnalyzeContracts(R"(
|
||||
function free() pure {}
|
||||
function intSuffix(uint) pure returns (uint) { free(); return 1; }
|
||||
function strSuffix(string memory) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
modifier m(uint) virtual { _; }
|
||||
|
||||
constructor() m(1 intSuffix) { "a" strSuffix; }
|
||||
function ext() external pure m("a" strSuffix) { 1 intSuffix; inr(); }
|
||||
function inr() internal pure { 1 intSuffix; }
|
||||
}
|
||||
)"s);
|
||||
tuple<CallGraphMap, CallGraphMap> graphs = collectGraphs(*compilerStack);
|
||||
|
||||
map<string, EdgeNames> expectedCreationEdges = {
|
||||
{"C", {
|
||||
{"Entry", "constructor of C"},
|
||||
{"constructor of C", "modifier C.m"},
|
||||
{"constructor of C", "function intSuffix(uint256)"},
|
||||
{"constructor of C", "function strSuffix(string)"},
|
||||
{"function intSuffix(uint256)", "function free()"},
|
||||
}},
|
||||
};
|
||||
|
||||
map<string, EdgeNames> expectedDeployedEdges = {
|
||||
{"C", {
|
||||
{"Entry", "function C.ext()"},
|
||||
{"function C.ext()", "modifier C.m"},
|
||||
{"function C.ext()", "function C.inr()"},
|
||||
{"function C.ext()", "function strSuffix(string)"},
|
||||
{"function C.ext()", "function intSuffix(uint256)"},
|
||||
{"function C.inr()", "function intSuffix(uint256)"},
|
||||
{"function intSuffix(uint256)", "function free()"},
|
||||
}},
|
||||
};
|
||||
|
||||
checkCallGraphExpectations(get<0>(graphs), expectedCreationEdges);
|
||||
checkCallGraphExpectations(get<1>(graphs), expectedDeployedEdges);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(events)
|
||||
{
|
||||
unique_ptr<CompilerStack> compilerStack = parseAndAnalyzeContracts(R"(
|
||||
|
@ -0,0 +1,11 @@
|
||||
function suffix(uint) pure returns (uint) {
|
||||
revert();
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
1 suffix;
|
||||
uint a = 0; // TODO: Should warn about unreachable code here
|
||||
a;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = 1000 suffix 1000 suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (105-109): Expected ';' but got 'Number'
|
@ -0,0 +1,7 @@
|
||||
function suffix(string memory s) pure returns (string memory) { return s; }
|
||||
|
||||
contract C {
|
||||
uint x = "abcd" suffix "abcd";
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (117-123): Expected ';' but got 'StringLiteral'
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = suffix 1000;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (100-104): Expected ';' but got 'Number'
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
uint x = 1000suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (85-89): Identifier-start is not allowed at end of a number.
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = 1000 suffix{gas: 1};
|
||||
}
|
||||
// ----
|
||||
// TypeError 2622: (93-112): Expected callable expression before call options.
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = 1000 suffix();
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (93-106): Type is not callable
|
@ -0,0 +1,11 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
assembly ("memory-safe" suffix) {
|
||||
pop(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (135-141): Expected ')' but got identifier
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
int x = int(1000) suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (102-108): Expected ';' but got identifier
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint a, uint b) pure returns (uint) { return a + b; }
|
||||
|
||||
contract C {
|
||||
uint x = 1000 1 suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (102-103): Expected ';' but got 'Number'
|
@ -0,0 +1,9 @@
|
||||
enum E {A, B, C}
|
||||
|
||||
function suffix(E) pure returns (E) {}
|
||||
|
||||
contract C {
|
||||
E e = E.A suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (85-91): Expected ';' but got identifier
|
@ -0,0 +1,11 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
error E();
|
||||
|
||||
function f() public {
|
||||
revert E suffix;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (131-137): Expected '(' but got identifier
|
@ -0,0 +1,11 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
event E();
|
||||
|
||||
function f() public {
|
||||
emit E suffix;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (129-135): Expected '(' but got identifier
|
@ -0,0 +1,31 @@
|
||||
function uintSuffix(uint x) pure returns (uint) {}
|
||||
function int8Suffix(uint x) pure returns (int8) {}
|
||||
function addressSuffix(uint x) pure returns (address) {}
|
||||
function decimalSuffix(uint m, uint e) pure returns (uint) {}
|
||||
function stringSuffix(uint x) pure returns (string memory) {}
|
||||
function bytesSuffix(uint x) pure returns (bytes memory) {}
|
||||
|
||||
contract C {
|
||||
uint[42 uintSuffix] a; // TODO: This should be an error too
|
||||
uint[42 int8Suffix] b; // TODO: This should be an error too
|
||||
uint[42 addressSuffix] c; // TODO: This should be an error too
|
||||
uint[42 decimalSuffix] d; // TODO: This should be an error too
|
||||
uint[42 stringSuffix] e; // TODO: This should be an error too
|
||||
uint[42 bytesSuffix] f; // TODO: This should be an error too
|
||||
}
|
||||
|
||||
contract D {
|
||||
uint[uintSuffix(42)] a;
|
||||
uint[int8Suffix(42)] b;
|
||||
uint[addressSuffix(42)] c;
|
||||
uint[decimalSuffix(42)] d;
|
||||
uint[stringSuffix(42)] e;
|
||||
uint[bytesSuffix(42)] f;
|
||||
}
|
||||
// ----
|
||||
// TypeError 5462: (790-804): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (818-832): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (846-863): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (877-894): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (908-924): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (938-953): Invalid array length, expected integer literal or constant expression.
|
@ -0,0 +1,22 @@
|
||||
function uintSuffix(uint x) pure returns (uint) { return x; }
|
||||
function int8Suffix(int8 x) pure returns (int8) { return x; }
|
||||
function addressSuffix(address x) pure returns (address) { return x; }
|
||||
function decimalSuffix(uint m, uint e) pure returns (uint) { return m + e; }
|
||||
function stringSuffix(string memory x) pure returns (string memory) { return x; }
|
||||
function bytesSuffix(bytes memory x) pure returns (bytes memory) { return x; }
|
||||
|
||||
contract C {
|
||||
uint constant a = 1 uintSuffix;
|
||||
int8 constant b = 1 int8Suffix;
|
||||
address constant c = 0x1234567890123456789012345678901234567890 addressSuffix;
|
||||
uint constant d = 1.1 decimalSuffix;
|
||||
string constant e = "a" stringSuffix;
|
||||
bytes constant f = hex"abcd" bytesSuffix;
|
||||
}
|
||||
// ----
|
||||
// TypeError 8349: (469-481): Initial value for constant variable has to be compile-time constant.
|
||||
// TypeError 8349: (505-517): Initial value for constant variable has to be compile-time constant.
|
||||
// TypeError 8349: (544-600): Initial value for constant variable has to be compile-time constant.
|
||||
// TypeError 8349: (624-641): Initial value for constant variable has to be compile-time constant.
|
||||
// TypeError 8349: (667-683): Initial value for constant variable has to be compile-time constant.
|
||||
// TypeError 8349: (708-729): Initial value for constant variable has to be compile-time constant.
|
@ -0,0 +1,5 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
uint immutable a = 1 suffix;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
function suffix(string memory s) pure returns (string memory) { return s; }
|
||||
|
||||
contract C {
|
||||
// TODO: This should be an error
|
||||
string s = "abcd" "" suffix;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
function suffix(string memory s, string memory) pure returns (string memory) { return s; }
|
||||
|
||||
contract C {
|
||||
string s = "abcd" "" suffix;
|
||||
}
|
||||
// ----
|
||||
// TypeError 4778: (120-136): Functions that take 2 arguments can only be used as literal suffixes for rational numbers.
|
@ -0,0 +1,11 @@
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
|
||||
function suffix(S memory) pure returns (S memory) {}
|
||||
|
||||
contract C {
|
||||
uint x = (S suffix);
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (109-115): Expected ',' but got identifier
|
@ -0,0 +1,8 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
function metasuffix(function (uint) pure returns (uint) value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = suffix metasuffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (201-211): Expected ';' but got identifier
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = 1000 suffix suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (105-111): Expected ';' but got identifier
|
@ -0,0 +1,8 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
uint v = 42;
|
||||
uint x = v suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (104-110): Expected ';' but got identifier
|
@ -0,0 +1,9 @@
|
||||
function selectorSuffix(uint) pure returns (bytes4) { return 0x12345678; }
|
||||
function signatureSuffix(string memory) pure returns (string memory) { return "f()"; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
abi.encodeWithSelector(1234 selectorSuffix);
|
||||
abi.encodeWithSignature("abcd" signatureSuffix);
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
function twice(uint x) pure returns (uint) { return x * 2; }
|
||||
|
||||
contract C {
|
||||
function f() public pure returns (uint[] memory) {
|
||||
return new uint[](5 twice);
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
suffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
function suffix(uint) pure returns (bool) {}
|
||||
|
||||
contract C {
|
||||
bool x = 1 suffix ? 2 suffix : 3 suffix ? 4 suffix : 5 suffix;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
struct S { uint x; }
|
||||
enum E {A, B, C}
|
||||
type T is uint72;
|
||||
interface I {}
|
||||
|
||||
function uintSuffix(uint) pure returns (uint) { return 1234; }
|
||||
function bytes4Suffix(uint) pure returns (bytes4) { return 0x12345678; }
|
||||
function addressSuffix(uint) pure returns (address) { return 0x1111111111222222222233333333334444444444; }
|
||||
function stringSuffix(uint) pure returns (string memory) { return "abcd"; }
|
||||
function bytesSuffix(uint) pure returns (bytes memory) { return "abcd"; }
|
||||
function arraySuffix(uint) pure returns (bytes3[3] memory) { return [bytes3(0x123456), 0x123456, 0x123456]; }
|
||||
function structSuffix(uint) pure returns (S memory) { return S(42); }
|
||||
function enumSuffix(uint) pure returns (E) { return E.A; }
|
||||
function udvtSuffix(uint) pure returns (T) { return T.wrap(1); }
|
||||
function interfaceSuffix(uint) pure returns (I) { return I(address(0)); }
|
||||
function functionSuffix(uint) pure returns (function (uint) pure returns (T)) { return udvtSuffix; }
|
||||
|
||||
contract C {
|
||||
uint a = 1 uintSuffix;
|
||||
bytes4 b = 1 bytes4Suffix;
|
||||
address c = 1 addressSuffix;
|
||||
string d = 1 stringSuffix;
|
||||
bytes e = 1 bytesSuffix;
|
||||
bytes3[3] f = 1 arraySuffix;
|
||||
S g = 1 structSuffix;
|
||||
E h = 1 enumSuffix;
|
||||
T i = 1 udvtSuffix;
|
||||
I j = 1 interfaceSuffix;
|
||||
function (uint) pure returns (T) k = 1 functionSuffix;
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,26 @@
|
||||
function s8(int8 x) pure returns (uint) {}
|
||||
function u8(uint8 x) pure returns (uint) {}
|
||||
function s16(int16 x) pure returns (uint) {}
|
||||
function u16(uint16 x) pure returns (uint) {}
|
||||
function s256(int x) pure returns (uint) {}
|
||||
function u256(uint x) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
function min() public pure {
|
||||
0 s8;
|
||||
0 u8;
|
||||
0 s16;
|
||||
0 u16;
|
||||
0 s256;
|
||||
0 u256;
|
||||
}
|
||||
|
||||
function max() public pure {
|
||||
127 s8;
|
||||
255 u8;
|
||||
32767 s16;
|
||||
65535 u16;
|
||||
57896044618658097711785492504343953926634992332820282019728792003956564819967 s256; // 2**255 - 1
|
||||
115792089237316195423570985008687907853269984665640564039457584007913129639935 u256; // 2**256 - 1
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
function s8(int8 x) pure returns (uint) {}
|
||||
function u8(uint8 x) pure returns (uint) {}
|
||||
function s16(int16 x) pure returns (uint) {}
|
||||
function u16(uint16 x) pure returns (uint) {}
|
||||
function s256(int x) pure returns (uint) {}
|
||||
function u256(uint x) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
function max() public pure {
|
||||
128 s8;
|
||||
256 u8;
|
||||
32768 s16;
|
||||
65536 u16;
|
||||
57896044618658097711785492504343953926634992332820282019728792003956564819968 s256; // 2**255
|
||||
115792089237316195423570985008687907853269984665640564039457584007913129639936 u256; // 2**256
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 8838: (322-328): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (338-344): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (354-363): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (373-382): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (392-474): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (494-577): The type of the literal cannot be converted to the parameter of the suffix function.
|
@ -0,0 +1,40 @@
|
||||
function s8(int8 m, uint e) pure returns (uint) {}
|
||||
function u8(uint8 m, uint e) pure returns (uint) {}
|
||||
function s16(int16 m, uint e) pure returns (uint) {}
|
||||
function u16(uint16 m, uint e) pure returns (uint) {}
|
||||
function s256(int m, uint e) pure returns (uint) {}
|
||||
function u256(uint m, uint e) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
function min() public pure {
|
||||
//0 s8; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0 u8; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0 s16; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0 u16; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0 s256; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0 u256; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
|
||||
//0.0 s8; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0.0 u8; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0.0 s16; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0.0 u16; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0.0 s256; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//0.0 u256; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
}
|
||||
|
||||
function max() public pure {
|
||||
//127 s8; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//255 u8; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//32767 s16; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//65535 u16; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//57896044618658097711785492504343953926634992332820282019728792003956564819967 s256; // 2**255 - 1 // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//115792089237316195423570985008687907853269984665640564039457584007913129639935 u256; // 2**256 - 1 // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
|
||||
1.27 s8;
|
||||
2.55 u8;
|
||||
3.2767 s16;
|
||||
6.5535 u16;
|
||||
5.7896044618658097711785492504343953926634992332820282019728792003956564819967 s256; // (2**255 - 1) * 10**-76
|
||||
1.15792089237316195423570985008687907853269984665640564039457584007913129639935 u256; // (2**256 - 1) * 10**-77
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
function s8(int8 m, uint e) pure returns (uint) {}
|
||||
function u8(uint8 m, uint e) pure returns (uint) {}
|
||||
function s16(int16 m, uint e) pure returns (uint) {}
|
||||
function u16(uint16 m, uint e) pure returns (uint) {}
|
||||
function s256(int m, uint e) pure returns (uint) {}
|
||||
function u256(uint m, uint e) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
function max() public pure {
|
||||
// TODO: For all of these the error should be that the mantissa or exponent is out of range.
|
||||
// Best if we can tell which of them.
|
||||
128 s8;
|
||||
256 u8;
|
||||
32768 s16;
|
||||
65536 u16;
|
||||
57896044618658097711785492504343953926634992332820282019728792003956564819968 s256; // 2**255
|
||||
115792089237316195423570985008687907853269984665640564039457584007913129639936 u256; // 2**256
|
||||
|
||||
1.28 s8;
|
||||
2.56 u8;
|
||||
3.2768 s16;
|
||||
6.5536 u16;
|
||||
5.7896044618658097711785492504343953926634992332820282019728792003956564819968 s256; // 2**255 * 10**-76
|
||||
1.15792089237316195423570985008687907853269984665640564039457584007913129639936 u256; // 2**256 * 10**-77
|
||||
|
||||
128_000 s8;
|
||||
256_000 u8;
|
||||
32768_000 s16;
|
||||
65536_000 u16;
|
||||
57896044618658097711785492504343953926634992332820282019728792003956564819968_000 s256; // 2**255 * 10**-76
|
||||
115792089237316195423570985008687907853269984665640564039457584007913129639936_000 u256; // 2**256 * 10**-77
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 8838: (517-523): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (533-539): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (549-558): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (568-577): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (587-669): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (689-772): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (793-800): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (810-817): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (827-837): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (847-857): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (867-950): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 5503: (980-1064): This fractional number cannot be decomposed into a mantissa and decimal exponent that fit the range of parameters of the suffix function.
|
||||
// TypeError 8838: (1095-1105): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (1115-1125): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (1135-1148): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (1158-1171): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (1181-1267): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (1297-1384): The type of the literal cannot be converted to the parameters of the suffix function.
|
@ -0,0 +1,19 @@
|
||||
struct S { uint x; }
|
||||
|
||||
function uintUintSuffix(uint) pure returns (uint, uint) {
|
||||
return (1, 2);
|
||||
}
|
||||
|
||||
function bytesStructContractSuffix(string memory s) pure returns (bytes memory, S memory, C) {
|
||||
return (bytes(s), S(42), C(address(0)));
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public pure returns (uint, uint) {
|
||||
return 1 uintUintSuffix;
|
||||
}
|
||||
|
||||
function g() public pure returns (bytes memory, S memory, C) {
|
||||
return "abcd" bytesStructContractSuffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
function nullSuffix(uint) pure {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
return 1 nullSuffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
function suffix(uint) pure returns (int) {}
|
||||
function suffix(bool) pure returns (int) {}
|
||||
function suffix(address) pure returns (int) {}
|
||||
function suffix(string memory) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
int a = 1 suffix; // TODO: Should match only uint
|
||||
int b = true suffix; // TODO: Should match only bool
|
||||
int c = 0x1234567890123456789012345678901234567890 suffix; // TODO: Should match only address
|
||||
int d = "a" suffix; // TODO: Should match only string
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (216-222): Identifier not found or not unique.
|
@ -0,0 +1,21 @@
|
||||
function uSuffix(uint8, uint) pure returns (int) {}
|
||||
function uSuffix(uint16, uint) pure returns (int) {}
|
||||
|
||||
function iSuffix(int8, uint) pure returns (int) {}
|
||||
function iSuffix(int16, uint) pure returns (int) {}
|
||||
|
||||
function iuSuffix(uint8, uint) pure returns (int) {}
|
||||
function iuSuffix(int8, uint) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
int a = 1.024 uSuffix; // TODO: Should match only (uint16, uint)
|
||||
int b = 1.024 iSuffix; // TODO: Should match only (int16, uint)
|
||||
|
||||
int c = -1.024 uSuffix; // TODO: Should match only (uint16, uint)
|
||||
int d = -1.024 iSuffix; // TODO: Should match only (int16, uint)
|
||||
|
||||
int e = 2.55 iuSuffix; // TODO: Should match only (uint8, uint)
|
||||
int f = -2.55 iuSuffix; // TODO: Should match only (uint8, uint)
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (347-354): Identifier not found or not unique.
|
@ -0,0 +1,8 @@
|
||||
function iuSuffix(uint8, uint) pure returns (uint) {}
|
||||
function iuSuffix(int8, uint) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
uint a = 1.27 iuSuffix;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (139-147): Identifier not found or not unique.
|
@ -0,0 +1,8 @@
|
||||
function uSuffix(uint8, uint) pure returns (uint) {}
|
||||
function uSuffix(uint16, uint) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
uint a = 1.27 uSuffix;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (139-146): Identifier not found or not unique.
|
@ -0,0 +1,14 @@
|
||||
function suffix256(uint) pure returns (int) {}
|
||||
function suffix256(uint, uint) pure returns (int) {}
|
||||
|
||||
function suffix8(uint) pure returns (int) {}
|
||||
function suffix8(uint8, uint) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
int a = 1.1 suffix256; // TODO: Should match only (uint, uint)
|
||||
int b = 1024 suffix8; // TODO: Should match only uint
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (263-272): Identifier not found or not unique.
|
@ -0,0 +1,10 @@
|
||||
function suffix(uint) pure returns (int) {}
|
||||
function suffix(uint, uint) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
int a = 1 suffix;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (157-163): Identifier not found or not unique.
|
@ -0,0 +1,21 @@
|
||||
function uSuffix(uint8) pure returns (int) {}
|
||||
function uSuffix(uint16) pure returns (int) {}
|
||||
|
||||
function iSuffix(int8) pure returns (int) {}
|
||||
function iSuffix(int16) pure returns (int) {}
|
||||
|
||||
function iuSuffix(uint8) pure returns (int) {}
|
||||
function iuSuffix(int8) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
int a = 1024 uSuffix; // TODO: Should match only uint16
|
||||
int b = 1024 iSuffix; // TODO: Should match only int16
|
||||
|
||||
int c = -1024 uSuffix; // TODO: Should match only uint16
|
||||
int d = -1024 iSuffix; // TODO: Should match only int16
|
||||
|
||||
int e = 255 iuSuffix; // TODO: Should match only uint8
|
||||
int f = -255 iuSuffix; // TODO: Should match only uint8
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (310-317): Identifier not found or not unique.
|
@ -0,0 +1,8 @@
|
||||
function iuSuffix(uint8) pure returns (int) {}
|
||||
function iuSuffix(int8) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
int a = 127 iuSuffix;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (123-131): Identifier not found or not unique.
|
@ -0,0 +1,8 @@
|
||||
function uSuffix(uint8) pure returns (int) {}
|
||||
function uSuffix(uint16) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
int a = 127 uSuffix;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (123-130): Identifier not found or not unique.
|
@ -0,0 +1,8 @@
|
||||
function suffix(string memory) pure returns (int) {}
|
||||
function suffix(bytes memory) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
int a = hex"abcd" suffix; // TODO: Should match only bytes
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (141-147): Identifier not found or not unique.
|
@ -0,0 +1,8 @@
|
||||
function suffix(string memory) pure returns (uint) {}
|
||||
function suffix(bytes memory) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
uint a = "abcd" suffix;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (141-147): Identifier not found or not unique.
|
@ -0,0 +1,14 @@
|
||||
function calldataSuffix(string memory s) pure returns (string memory) {}
|
||||
function memorySuffix(string calldata s) pure returns (string memory) {}
|
||||
function storageSuffix(string storage s) pure returns (string memory) {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
"a" calldataSuffix;
|
||||
"a" memorySuffix;
|
||||
"a" storageSuffix;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 8838: (300-316): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (326-343): The type of the literal cannot be converted to the parameter of the suffix function.
|
@ -0,0 +1,23 @@
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
|
||||
function structSuffix(uint x) pure returns (S calldata s) {
|
||||
assembly ("memory-safe") {
|
||||
s := x
|
||||
}
|
||||
}
|
||||
|
||||
function arraySuffix(uint x) pure returns (uint[5] calldata a) {
|
||||
assembly ("memory-safe") {
|
||||
a := x
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
// TODO: Using functions with calldata return type as suffixes should be disallowed
|
||||
1 structSuffix;
|
||||
1 arraySuffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
|
||||
function structSuffix(uint x) pure returns (S memory s) {}
|
||||
function arraySuffix(uint x) pure returns (uint[5] memory a) {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
1 structSuffix;
|
||||
1 arraySuffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
|
||||
function structSuffix(uint x) pure returns (S storage s) {
|
||||
assembly ("memory-safe") {
|
||||
s.slot := x
|
||||
}
|
||||
}
|
||||
|
||||
function arraySuffix(uint x) pure returns (uint[5] storage a) {
|
||||
assembly ("memory-safe") {
|
||||
a.slot := x
|
||||
}
|
||||
}
|
||||
|
||||
function mappingSuffix(uint x) pure returns (mapping(uint => uint) storage m) {
|
||||
assembly ("memory-safe") {
|
||||
m.slot := x
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
// TODO: Using functions with storage return type as suffixes should be disallowed
|
||||
1 structSuffix;
|
||||
1 arraySuffix;
|
||||
1 mappingSuffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
function zero() pure returns (uint) { return 1; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
1 zero;
|
||||
1.1 zero;
|
||||
"a" zero;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4778: (103-109): Functions that take no arguments cannot be used as literal suffixes.
|
||||
// TypeError 4778: (119-127): Functions that take no arguments cannot be used as literal suffixes.
|
||||
// TypeError 4778: (137-145): Functions that take no arguments cannot be used as literal suffixes.
|
@ -0,0 +1,36 @@
|
||||
function uintUintUintSuffix(uint, uint, uint) pure returns (uint) { return 1; }
|
||||
function stringStringStringSuffix(string memory, string memory, string memory) pure returns (uint) { return 1; }
|
||||
function uintStringSuffix(uint, string memory) pure returns (uint) { return 1; }
|
||||
function stringUintSuffix(string memory, uint) pure returns (uint) { return 1; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
1 uintUintUintSuffix;
|
||||
1 stringStringStringSuffix;
|
||||
1 uintStringSuffix;
|
||||
1 stringUintSuffix;
|
||||
|
||||
1.1 uintUintUintSuffix;
|
||||
1.1 stringStringStringSuffix;
|
||||
1.1 uintStringSuffix;
|
||||
1.1 stringUintSuffix;
|
||||
|
||||
"a" uintUintUintSuffix;
|
||||
"a" stringStringStringSuffix;
|
||||
"a" uintStringSuffix;
|
||||
"a" stringUintSuffix;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4778: (408-428): Functions that take 3 or more arguments cannot be used as literal suffixes.
|
||||
// TypeError 4778: (438-464): Functions that take 3 or more arguments cannot be used as literal suffixes.
|
||||
// TypeError 8838: (474-492): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (502-520): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 4778: (531-553): Functions that take 3 or more arguments cannot be used as literal suffixes.
|
||||
// TypeError 4778: (563-591): Functions that take 3 or more arguments cannot be used as literal suffixes.
|
||||
// TypeError 8838: (601-621): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 8838: (631-651): The type of the literal cannot be converted to the parameters of the suffix function.
|
||||
// TypeError 4778: (662-684): Functions that take 3 or more arguments cannot be used as literal suffixes.
|
||||
// TypeError 4778: (694-722): Functions that take 3 or more arguments cannot be used as literal suffixes.
|
||||
// TypeError 4778: (732-752): Functions that take 2 arguments can only be used as literal suffixes for rational numbers.
|
||||
// TypeError 4778: (762-782): Functions that take 2 arguments can only be used as literal suffixes for rational numbers.
|
@ -0,0 +1,106 @@
|
||||
function uintSuffix(uint) pure returns (uint) { return 1; }
|
||||
function int8Suffix(int8) pure returns (uint) { return 1; }
|
||||
function boolSuffix(bool) pure returns (uint) { return 1; }
|
||||
function addressSuffix(address) pure returns (uint) { return 1; }
|
||||
function decimalSuffix(uint, uint) pure returns (uint) { return 1; }
|
||||
function stringSuffix(string memory) pure returns (uint) { return 1; }
|
||||
function bytesSuffix(bytes memory) pure returns (uint) { return 1; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
1 uintSuffix; // allowed
|
||||
1 int8Suffix; // allowed
|
||||
1 boolSuffix;
|
||||
1 addressSuffix;
|
||||
1 decimalSuffix; // allowed
|
||||
1 stringSuffix;
|
||||
1 bytesSuffix;
|
||||
|
||||
1024 uintSuffix; // allowed
|
||||
1024 int8Suffix;
|
||||
1024 boolSuffix;
|
||||
1024 addressSuffix;
|
||||
1024 decimalSuffix; // allowed
|
||||
1024 stringSuffix;
|
||||
1024 bytesSuffix;
|
||||
|
||||
true uintSuffix;
|
||||
true int8Suffix;
|
||||
true boolSuffix; // allowed
|
||||
true addressSuffix;
|
||||
true decimalSuffix;
|
||||
true stringSuffix;
|
||||
true bytesSuffix;
|
||||
|
||||
0x1234567890123456789012345678901234567890 uintSuffix;
|
||||
0x1234567890123456789012345678901234567890 int8Suffix;
|
||||
0x1234567890123456789012345678901234567890 boolSuffix;
|
||||
0x1234567890123456789012345678901234567890 addressSuffix; // allowed
|
||||
0x1234567890123456789012345678901234567890 decimalSuffix;
|
||||
0x1234567890123456789012345678901234567890 stringSuffix;
|
||||
0x1234567890123456789012345678901234567890 bytesSuffix;
|
||||
|
||||
1.1 uintSuffix;
|
||||
1.1 int8Suffix;
|
||||
1.1 boolSuffix;
|
||||
1.1 addressSuffix;
|
||||
1.1 decimalSuffix; // allowed
|
||||
1.1 stringSuffix;
|
||||
1.1 bytesSuffix;
|
||||
|
||||
"a" uintSuffix;
|
||||
"a" int8Suffix;
|
||||
"a" boolSuffix;
|
||||
"a" addressSuffix;
|
||||
"a" decimalSuffix;
|
||||
"a" stringSuffix; // allowed
|
||||
"a" bytesSuffix; // allowed
|
||||
|
||||
hex"abcd" uintSuffix;
|
||||
hex"abcd" int8Suffix;
|
||||
hex"abcd" boolSuffix;
|
||||
hex"abcd" addressSuffix;
|
||||
hex"abcd" decimalSuffix;
|
||||
hex"abcd" stringSuffix;
|
||||
hex"abcd" bytesSuffix; // allowed
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 8838: (586-598): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (608-623): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (672-686): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (696-709): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (759-774): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (784-799): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (809-827): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (876-893): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (903-919): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (930-945): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (955-970): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1019-1037): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 4778: (1047-1065): Functions that take 2 arguments can only be used as literal suffixes for rational numbers.
|
||||
// TypeError 8838: (1075-1092): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1102-1118): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1129-1182): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1192-1245): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1255-1308): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 4778: (1395-1451): Functions that take 2 arguments can only be used as literal suffixes for rational numbers.
|
||||
// TypeError 8838: (1461-1516): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1526-1580): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1591-1605): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1615-1629): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1639-1653): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1663-1680): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1728-1744): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1754-1769): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1780-1794): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1804-1818): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1828-1842): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (1852-1869): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 4778: (1879-1896): Functions that take 2 arguments can only be used as literal suffixes for rational numbers.
|
||||
// TypeError 8838: (1983-2003): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (2013-2033): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (2043-2063): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (2073-2096): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 4778: (2106-2129): Functions that take 2 arguments can only be used as literal suffixes for rational numbers.
|
||||
// TypeError 8838: (2139-2161): The type of the literal cannot be converted to the parameter of the suffix function.
|
@ -0,0 +1,15 @@
|
||||
function uintSuffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
function g(uint) public {}
|
||||
|
||||
function f() public {
|
||||
abi.encode(1 uintSuffix);
|
||||
abi.encodePacked(2 uintSuffix);
|
||||
abi.encodeWithSelector(0x12345678, 3 uintSuffix);
|
||||
abi.encodeWithSignature("f()", 4 uintSuffix);
|
||||
abi.encodeCall(this.g, 5 uintSuffix);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2018: (112-371): Function state mutability can be restricted to view
|
@ -0,0 +1,18 @@
|
||||
function uintUintSuffix(uint x) pure returns (uint, uint) { return (x, x); }
|
||||
|
||||
contract C {
|
||||
function g(uint, uint) public {}
|
||||
|
||||
function f() public {
|
||||
abi.encode(1 uintUintSuffix);
|
||||
abi.encodePacked(2 uintUintSuffix);
|
||||
abi.encodeWithSelector(0x12345678, 3 uintUintSuffix);
|
||||
abi.encodeWithSignature("f()", 4 uintUintSuffix);
|
||||
//abi.encodeCall(this.g, 5 uintUintSuffix); // TODO: Causes an ICE
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2056: (174-190): This type cannot be encoded.
|
||||
// TypeError 2056: (218-234): This type cannot be encoded.
|
||||
// TypeError 2056: (280-296): This type cannot be encoded.
|
||||
// TypeError 2056: (338-354): This type cannot be encoded.
|
@ -0,0 +1,21 @@
|
||||
function nullSuffix(uint) pure {}
|
||||
|
||||
contract C {
|
||||
function g() public {}
|
||||
|
||||
function h() public returns (uint, uint) {}
|
||||
|
||||
event E();
|
||||
function f() public {
|
||||
abi.encode(1 nullSuffix);
|
||||
abi.encodePacked(2 nullSuffix);
|
||||
abi.encodeWithSelector(0x12345678, 3 nullSuffix);
|
||||
abi.encodeWithSignature("f()", 4 nullSuffix);
|
||||
//abi.encodeCall(this.g, 5 nullSuffix); // TODO: Causes an ICE
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2056: (185-197): This type cannot be encoded.
|
||||
// TypeError 2056: (225-237): This type cannot be encoded.
|
||||
// TypeError 2056: (283-295): This type cannot be encoded.
|
||||
// TypeError 2056: (337-349): This type cannot be encoded.
|
@ -0,0 +1,24 @@
|
||||
function s(uint value) pure returns (uint) { return value; }
|
||||
function z(uint value) pure returns (uint) { return value; }
|
||||
function q(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
address z;
|
||||
|
||||
function q() internal {}
|
||||
|
||||
function f() public {
|
||||
uint s;
|
||||
|
||||
1 s;
|
||||
2 z;
|
||||
3 q;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2519: (277-283): This declaration shadows an existing declaration.
|
||||
// Warning 2519: (201-210): This declaration shadows an existing declaration.
|
||||
// Warning 2519: (217-241): This declaration shadows an existing declaration.
|
||||
// TypeError 4438: (294-297): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (307-310): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (320-323): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,27 @@
|
||||
function s(uint x) pure returns (uint) { return x; }
|
||||
function S(uint x) pure returns (uint) { return x; }
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
function SUFFIX(uint x) pure returns (uint) { return x; }
|
||||
function suffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffix(uint x) pure returns (uint) { return x; }
|
||||
function __(uint x) pure returns (uint) { return x; }
|
||||
function _____________________________________(uint x) pure returns (uint) { return x; }
|
||||
function _s_(uint x) pure returns (uint) { return x; }
|
||||
function $(uint x) pure returns (uint) { return x; }
|
||||
function _$(uint x) pure returns (uint) { return x; }
|
||||
function abcdef(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
1000 s;
|
||||
1000 S;
|
||||
1000 suffix;
|
||||
1000 SUFFIX;
|
||||
1000 suffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffix;
|
||||
1000 __;
|
||||
1000 _____________________________________;
|
||||
1000 _s_;
|
||||
1000 $;
|
||||
1000 _$;
|
||||
0x1000_abcdef abcdef;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
function suffix(address payable a) pure returns (address payable) { return a; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
0x1234567890123456789012345678901234567890 suffix;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 8838: (133-182): The type of the literal cannot be converted to the parameter of the suffix function.
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = 0x1234567890123456789012345678901234567890 suffix;
|
||||
}
|
||||
// ----
|
||||
// TypeError 8838: (93-142): The type of the literal cannot be converted to the parameter of the suffix function.
|
@ -0,0 +1,7 @@
|
||||
function suffix(address value) pure returns (address) { return value; }
|
||||
|
||||
contract C {
|
||||
address x = 0x123456789012345678901234567890123456789 suffix;
|
||||
}
|
||||
// ----
|
||||
// SyntaxError 9429: (102-150): This looks like an address but is not exactly 40 hex digits. It is 39 hex digits. If this is not used as an address, please prepend '00'. For more information please see https://docs.soliditylang.org/en/develop/types.html#address-literals
|
@ -0,0 +1,7 @@
|
||||
function suffix(address value) pure returns (address) { return value; }
|
||||
|
||||
contract C {
|
||||
address x = 0x12345678901234567890123456789012345678901 suffix;
|
||||
}
|
||||
// ----
|
||||
// SyntaxError 9429: (102-152): This looks like an address but is not exactly 40 hex digits. It is 41 hex digits. If this is not used as an address, please prepend '00'. For more information please see https://docs.soliditylang.org/en/develop/types.html#address-literals
|
@ -0,0 +1,7 @@
|
||||
function suffix(address value) pure returns (address) { return value; }
|
||||
|
||||
contract C {
|
||||
address x = 0xffffffffffffffffffffffffffffffffffffffff suffix;
|
||||
}
|
||||
// ----
|
||||
// SyntaxError 9429: (102-151): This looks like an address but has an invalid checksum. Correct checksummed address: "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF". If this is not used as an address, please prepend '00'. For more information please see https://docs.soliditylang.org/en/develop/types.html#address-literals
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint[1] memory) pure returns (uint[1] memory) {}
|
||||
|
||||
contract C {
|
||||
uint[1] x = [42] suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (100-106): Expected ';' but got identifier
|
@ -0,0 +1,12 @@
|
||||
struct Decimal {
|
||||
uint mantissa;
|
||||
uint exponent;
|
||||
}
|
||||
|
||||
function suffix(uint mantissa, uint exponent) pure returns (Decimal memory) { return Decimal(mantissa, exponent); }
|
||||
|
||||
contract C {
|
||||
Decimal x = 0.115792089237316195423570985008687907853269984665640564039457584007913129639936 suffix; // 2**256 * 10**-78
|
||||
}
|
||||
// ----
|
||||
// TypeError 5503: (204-291): This fractional number cannot be decomposed into a mantissa and decimal exponent that fit the range of parameters of the suffix function.
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = 000.10 suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (93-94): Octal numbers not allowed.
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = 01_23_45 suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (93-94): Octal numbers not allowed.
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint value) pure returns (uint) { return value; }
|
||||
|
||||
contract C {
|
||||
uint x = 00 suffix;
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (93-94): Octal numbers not allowed.
|
@ -0,0 +1,9 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
uint x = 10e1000 suffix;
|
||||
uint y = 999999999999999999999999999999999999999999999999999999999999999999999999999999 suffix;
|
||||
}
|
||||
// ----
|
||||
// TypeError 8838: (85-99): The type of the literal cannot be converted to the parameter of the suffix function.
|
||||
// TypeError 8838: (114-199): The type of the literal cannot be converted to the parameter of the suffix function.
|
@ -0,0 +1,31 @@
|
||||
function asUint(uint x) pure returns (uint) {}
|
||||
function asSint(int x) pure returns (uint) {}
|
||||
function asUdec(uint m, uint e) pure returns (uint) {}
|
||||
function asSdec(int m, uint e) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
1 asUint;
|
||||
1 asSint;
|
||||
1 asUdec;
|
||||
1 asSdec;
|
||||
|
||||
-1 asUint;
|
||||
-1 asSint;
|
||||
-1 asUdec;
|
||||
-1 asSdec;
|
||||
|
||||
1.1 asUdec;
|
||||
1.1 asSdec;
|
||||
|
||||
-1.1 asUdec;
|
||||
-1.1 asSdec;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4907: (328-337): Unary operator - cannot be applied to type uint256. Unary negation is only allowed for signed integers.
|
||||
// TypeError 4907: (347-356): Unary operator - cannot be applied to type uint256. Unary negation is only allowed for signed integers.
|
||||
// TypeError 4907: (366-375): Unary operator - cannot be applied to type uint256. Unary negation is only allowed for signed integers.
|
||||
// TypeError 4907: (385-394): Unary operator - cannot be applied to type uint256. Unary negation is only allowed for signed integers.
|
||||
// TypeError 4907: (446-457): Unary operator - cannot be applied to type uint256. Unary negation is only allowed for signed integers.
|
||||
// TypeError 4907: (467-478): Unary operator - cannot be applied to type uint256. Unary negation is only allowed for signed integers.
|
@ -0,0 +1,7 @@
|
||||
function suffix(string memory value) pure returns (string memory) { return value; }
|
||||
|
||||
contract C {
|
||||
string x = hex"abcd" suffix;
|
||||
}
|
||||
// ----
|
||||
// TypeError 8838: (113-129): The type of the literal cannot be converted to the parameter of the suffix function.
|
@ -0,0 +1,9 @@
|
||||
function suffix(uint, uint) pure returns (uint) {}
|
||||
|
||||
contract C {
|
||||
function f() public {
|
||||
(1, 2) suffix;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (106-112): Expected ';' but got identifier
|
@ -0,0 +1,12 @@
|
||||
function suffix(address a) pure returns (address) { return a; }
|
||||
function payableSuffix(address payable a) pure returns (address payable) { return a; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
0x0000000000000000000000000000000000000000 suffix;
|
||||
0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF suffix;
|
||||
0x1234567890123456789012345678901234567890 suffix;
|
||||
|
||||
0x1234567890_1234567890_1234567890_1234567890 suffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
function suffix(bool x) pure returns (bool) {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
true suffix;
|
||||
false suffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
function suffix(bytes memory value) pure returns (bytes memory) { return value; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
"" suffix;
|
||||
'' suffix;
|
||||
"abcd" suffix;
|
||||
'abcd' suffix;
|
||||
hex"abcd" suffix;
|
||||
unicode"😃" suffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
struct Decimal {
|
||||
uint mantissa;
|
||||
uint exponent;
|
||||
}
|
||||
|
||||
function e(uint mantissa, uint exponent) pure returns (Decimal memory) {
|
||||
return Decimal(mantissa, exponent);
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
0.1 e;
|
||||
0.100000 e;
|
||||
0.123456 e;
|
||||
0.0000000000000000000000000000000000000000000000000000000000000000000000000000001 e;
|
||||
0.115792089237316195423570985008687907853269984665640564039457584007913129639935 e; // (2**256 - 1) * 10**-78
|
||||
|
||||
// Decimal with separators
|
||||
1_2_3_4_5_6_7_8_9_0.1_2_3_4_5_6_7_8_9_0 e;
|
||||
1_000.1234 e;
|
||||
1_000.123_456 e;
|
||||
1_000_000.123 e;
|
||||
1_000_000.123_456_789 e;
|
||||
|
||||
// Scientific notation
|
||||
1e-01 e;
|
||||
1e-1 e;
|
||||
1e-10 e;
|
||||
1234e-10 e;
|
||||
1e-80 e;
|
||||
|
||||
// Scientific notation with decimals
|
||||
0.1e0 e;
|
||||
0.1e-0 e;
|
||||
0.1e-1 e;
|
||||
0.1e-10 e;
|
||||
1.1e0 e;
|
||||
10.1e0 e;
|
||||
100.1_111e-2 e;
|
||||
10.000000000000111e10 e;
|
||||
|
||||
1.23e0 e;
|
||||
1.23e1 e;
|
||||
1.23e-1 e;
|
||||
10.1e-1 e;
|
||||
1000.1e-0003 e;
|
||||
1200.1e-2 e;
|
||||
0.00115792089237316195423570985008687907853269984665640564039457584007913129639935e2 e; // (2**256 - 1) * 10**-80 * 10**2
|
||||
0.00115792089237316195423570985008687907853269984665640564039457584007913129639935e-2 e; // (2**256 - 1) * 10**-80 * 10**-2
|
||||
|
||||
// Scientific notation with separators
|
||||
1_2_34e-10 e;
|
||||
1_0.123456789123e1_0 e;
|
||||
1.123_456e3 e;
|
||||
10_000_000_000.123456789123e1_0 e;
|
||||
10_000_000_000.1_234_56789_123e1_0 e;
|
||||
10_000_000_000.1e-0_0_0_1_0 e;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
function e(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
// Zero and non-zero number
|
||||
0 e;
|
||||
1 e;
|
||||
1000 e;
|
||||
115792089237316195423570985008687907853269984665640564039457584007913129639935 e; // 2**256 - 1
|
||||
0.0 e;
|
||||
0.00 e;
|
||||
1.0000 e;
|
||||
9999.0 e;
|
||||
|
||||
// Hexadecimal
|
||||
0x0 e;
|
||||
0x0000 e;
|
||||
0x1234 e;
|
||||
0xffffff e;
|
||||
|
||||
// Almost address
|
||||
0x000012345678901234567890123456789012345678 e;
|
||||
0x12345678901234567890123456789012345678 e;
|
||||
|
||||
// Hexadecimal that resembles scientific notation
|
||||
0x0e0 e;
|
||||
0x111e0 e;
|
||||
0xeeeee e;
|
||||
0x10e10 e;
|
||||
0x10e76 e;
|
||||
|
||||
// Number with separators
|
||||
1_2_3_4_5_6_7_8_9_0 e;
|
||||
1_000 e;
|
||||
1_000_000 e;
|
||||
9999_9999_9999 e;
|
||||
0x123_abc e;
|
||||
1_000.0 e;
|
||||
1_000.000_000 e;
|
||||
|
||||
// Scientific notation
|
||||
0e0 e;
|
||||
0e-0 e;
|
||||
0e-1 e;
|
||||
0e-10 e;
|
||||
1e0 e;
|
||||
10e0 e;
|
||||
|
||||
10e10 e;
|
||||
10e76 e;
|
||||
|
||||
10e-1 e;
|
||||
1000e-0003 e;
|
||||
1200e-2 e;
|
||||
|
||||
// Scientific notation with decimals
|
||||
0.0e0 e;
|
||||
0.0e-0 e;
|
||||
0.0e-1 e;
|
||||
0.0e-10 e;
|
||||
1.0e0 e;
|
||||
1.0e2 e;
|
||||
10.0e0 e;
|
||||
100.0_000e-2 e;
|
||||
1.23e2 e;
|
||||
0.00115792089237316195423570985008687907853269984665640564039457584007913129639935e80 e; // (2**256 - 1) * 10**-80 * 10**80
|
||||
|
||||
// Scientific notation with separators
|
||||
1_0e1_0 e;
|
||||
10_000_000_000e1_0 e;
|
||||
10_000_000_000e-0_0_0_1_0 e;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
function asUint(uint x) pure returns (int) {}
|
||||
function asSint(int x) pure returns (int) {}
|
||||
function asUdec(uint m, uint e) pure returns (int) {}
|
||||
function asSdec(int m, uint e) pure returns (int) {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
1 asUint;
|
||||
1 asSint;
|
||||
//1 asUdec; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//1 asSdec; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
|
||||
-1 asUint;
|
||||
-1 asSint;
|
||||
//-1 asUdec; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
//-1 asSdec; // TODO: Needs codegen changes to work. Currently throws in StackHeightChecker.
|
||||
|
||||
1.1 asUdec;
|
||||
1.1 asSdec;
|
||||
|
||||
-1.1 asUdec;
|
||||
-1.1 asSdec;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
function suffix(string memory value) pure returns (string memory) { return value; }
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
"" suffix;
|
||||
'' suffix;
|
||||
"abcd" suffix;
|
||||
'abcd' suffix;
|
||||
//hex"abcd" suffix; // Hex literals are only implicitly convertible to bytes
|
||||
unicode"😃" suffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
==== Source: A.sol ====
|
||||
function s(uint) pure returns (uint) { return 1; }
|
||||
==== Source: B.sol ====
|
||||
import {s} from "A.sol";
|
||||
import {s as z} from "A.sol";
|
||||
import "A.sol" as A;
|
||||
import "B.sol" as B;
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
1 s;
|
||||
2 z;
|
||||
3 A.s;
|
||||
4 B.B.B.A.s;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
1 0x1234567890123456789012345678901234567890.send;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (54-96): Expected ';' but got 'Number'
|
@ -0,0 +1,10 @@
|
||||
function suffix(uint x, uint y) pure returns (uint) { return x + y; }
|
||||
|
||||
contract C {
|
||||
using {suffix} for uint;
|
||||
|
||||
uint a = 42;
|
||||
uint b = 1000 a.suffix;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (149-157): Identifier not found or not unique.
|
@ -0,0 +1,12 @@
|
||||
library L {
|
||||
function suffix(uint x, uint y) internal pure returns (uint) { return x + y; }
|
||||
}
|
||||
|
||||
contract C {
|
||||
using L for uint;
|
||||
|
||||
uint a = 42;
|
||||
uint b = 1000 a.suffix;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (169-177): Identifier not found or not unique.
|
@ -0,0 +1,15 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
hex"abcd" keccak256;
|
||||
1 blockhash;
|
||||
true assert;
|
||||
0x1234567890123456789012345678901234567890 selfdestruct;
|
||||
1 gasleft;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4438: (52-71): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (81-92): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (102-113): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (123-178): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (188-197): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,8 @@
|
||||
error E(uint x);
|
||||
|
||||
contract C {
|
||||
uint a = 1000 E;
|
||||
|
||||
}
|
||||
// ----
|
||||
// TypeError 4438: (44-50): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
event E(uint x);
|
||||
|
||||
uint a = 1000 E;
|
||||
|
||||
}
|
||||
// ----
|
||||
// TypeError 4438: (48-54): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
1 uint;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (54-58): Expected ';' but got 'uint'
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
uint a = 1000 this.suffix;
|
||||
|
||||
function suffix(uint x) external pure returns (uint) { return x; }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (31-42): Identifier not found or not unique.
|
@ -0,0 +1,9 @@
|
||||
library L {
|
||||
function suffix(uint x) external pure returns (uint) { return x; }
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x = 1000 L.suffix;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (117-125): Identifier not found or not unique.
|
@ -0,0 +1,7 @@
|
||||
function suffix(uint x) payable returns (uint) {}
|
||||
|
||||
contract C {
|
||||
uint a = 1000 suffix;
|
||||
}
|
||||
// ----
|
||||
// TypeError 9559: (0-49): Free functions cannot be payable.
|
@ -0,0 +1,14 @@
|
||||
function suffix(uint x) pure returns (uint) { return x; }
|
||||
|
||||
contract C {
|
||||
function (uint) pure returns (uint) storagePtr = suffix;
|
||||
|
||||
function f() public pure {
|
||||
function (uint) pure returns (uint) localPtr = suffix;
|
||||
1000 localPtr;
|
||||
1000 storagePtr;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4438: (236-249): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (259-274): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
uint public g;
|
||||
|
||||
uint a = 1 this.g;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (48-54): Identifier not found or not unique.
|
@ -0,0 +1,15 @@
|
||||
contract B {
|
||||
function inheritedSuffix(uint x) internal pure returns (uint) { return x; }
|
||||
}
|
||||
|
||||
contract C is B {
|
||||
uint a = 1000 suffix;
|
||||
uint b = 1000 B.inheritedSuffix;
|
||||
uint c = 1000 C.suffix;
|
||||
|
||||
function suffix(uint x) internal pure returns (uint) { return x; }
|
||||
}
|
||||
// ----
|
||||
// TypeError 4438: (127-138): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (153-175): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
||||
// TypeError 4438: (190-203): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,9 @@
|
||||
library L {
|
||||
function suffix(uint x) internal pure returns (uint) { return x; }
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x = 1000 L.suffix;
|
||||
}
|
||||
// ----
|
||||
// TypeError 4438: (112-125): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
uint a = 1000 suffix;
|
||||
|
||||
modifier suffix(uint x) { _; }
|
||||
}
|
||||
// ----
|
||||
// TypeError 4438: (26-37): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
uint a = 1000 suffix;
|
||||
|
||||
function suffix(uint x) public pure returns (uint) { return x; }
|
||||
}
|
||||
// ----
|
||||
// TypeError 4438: (26-37): The literal suffix needs to be a pre-defined suffix or a file-level function.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
1 revert;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (54-60): Identifier not found or not unique.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
(1 type).max;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (55-59): Expected ',' but got 'type'
|
@ -0,0 +1,11 @@
|
||||
abstract contract B {
|
||||
function suffix(uint x) internal pure virtual returns (uint);
|
||||
}
|
||||
|
||||
contract C is B {
|
||||
uint a = 1000 suffix;
|
||||
|
||||
function suffix(uint x) internal pure override returns (uint) { return x; }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (127-133): Identifier not found or not unique.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user