diff options
author | chriseth <chris@ethereum.org> | 2018-03-16 19:39:30 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-04-12 04:00:21 +0800 |
commit | 2ad1acaf721072d27783d586048d6377be6c3f99 (patch) | |
tree | 6b3454a46ff67e2c68e424b4d437fd96cb1c7a02 /test/libsolidity/syntaxTests/modifiers | |
parent | d64e93332704ade6cc2078c0c37956e1c9e8af9e (diff) | |
download | dexon-solidity-2ad1acaf721072d27783d586048d6377be6c3f99.tar.gz dexon-solidity-2ad1acaf721072d27783d586048d6377be6c3f99.tar.zst dexon-solidity-2ad1acaf721072d27783d586048d6377be6c3f99.zip |
Warn if modifiers are applied to functions without implementation.
Diffstat (limited to 'test/libsolidity/syntaxTests/modifiers')
-rw-r--r-- | test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_050.sol | 10 | ||||
-rw-r--r-- | test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol | 13 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_050.sol b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_050.sol new file mode 100644 index 00000000..af1babbc --- /dev/null +++ b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_050.sol @@ -0,0 +1,10 @@ +pragma experimental "v0.5.0"; +contract C +{ + modifier only_owner() { _; } + function foo() only_owner public; + function bar() public only_owner; +} +// ---- +// SyntaxError: (80-113): Functions without implementation cannot have modifiers. +// SyntaxError: (118-151): Functions without implementation cannot have modifiers. diff --git a/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol new file mode 100644 index 00000000..e18c5cf9 --- /dev/null +++ b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol @@ -0,0 +1,13 @@ +// Previous versions of Solidity turned this +// into a parser error (they wrongly recognized +// these functions as state variables of +// function type). +contract C +{ + modifier only_owner() { _; } + function foo() only_owner public; + function bar() public only_owner; +} +// ---- +// Warning: (203-236): Modifiers of functions without implementation are ignored. +// Warning: (241-274): Modifiers of functions without implementation are ignored. |