diff options
author | chriseth <chris@ethereum.org> | 2018-06-29 00:08:45 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-06-29 06:23:52 +0800 |
commit | eeef82b2d77c6f956039c57b0598e684254ee6dd (patch) | |
tree | 82887915936dbf242d5574c1fe9d61f5ace312d9 /test/libsolidity/syntaxTests/fallback | |
parent | 4268062985e434b00f07e3f90772b94538933b9c (diff) | |
download | dexon-solidity-eeef82b2d77c6f956039c57b0598e684254ee6dd.tar.gz dexon-solidity-eeef82b2d77c6f956039c57b0598e684254ee6dd.tar.zst dexon-solidity-eeef82b2d77c6f956039c57b0598e684254ee6dd.zip |
Fallback function has to be external: backwards-compatible changes.
Diffstat (limited to 'test/libsolidity/syntaxTests/fallback')
3 files changed, 10 insertions, 4 deletions
diff --git a/test/libsolidity/syntaxTests/fallback/default_visibility.sol b/test/libsolidity/syntaxTests/fallback/default_visibility.sol new file mode 100644 index 00000000..2cb0af90 --- /dev/null +++ b/test/libsolidity/syntaxTests/fallback/default_visibility.sol @@ -0,0 +1,6 @@ +contract C { + // Check that visibility is also enforced for the fallback function. + function() {} +} +// ---- +// Warning: (90-103): No visibility specified. Defaulting to "public". diff --git a/test/libsolidity/syntaxTests/fallback/pure_modifier.sol b/test/libsolidity/syntaxTests/fallback/pure_modifier.sol index 20d5b0ac..12d790d1 100644 --- a/test/libsolidity/syntaxTests/fallback/pure_modifier.sol +++ b/test/libsolidity/syntaxTests/fallback/pure_modifier.sol @@ -1,6 +1,6 @@ contract C { uint x; - function() pure { x = 2; } + function() external pure { x = 2; } } // ---- -// TypeError: (29-55): Fallback function must be payable or non-payable, but is "pure". +// TypeError: (29-64): Fallback function must be payable or non-payable, but is "pure". diff --git a/test/libsolidity/syntaxTests/fallback/view_modifier.sol b/test/libsolidity/syntaxTests/fallback/view_modifier.sol index 44c5d204..2497e9fa 100644 --- a/test/libsolidity/syntaxTests/fallback/view_modifier.sol +++ b/test/libsolidity/syntaxTests/fallback/view_modifier.sol @@ -1,6 +1,6 @@ contract C { uint x; - function() view { x = 2; } + function() external view { x = 2; } } // ---- -// TypeError: (29-55): Fallback function must be payable or non-payable, but is "view". +// TypeError: (29-64): Fallback function must be payable or non-payable, but is "view". |