mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Warn if modifiers are applied to functions without implementation.
This commit is contained in:
@@ -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.
|
||||
+13
@@ -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.
|
||||
Reference in New Issue
Block a user