Warn if modifiers are applied to functions without implementation.

This commit is contained in:
chriseth
2018-04-11 22:00:21 +02:00
parent d64e933327
commit 2ad1acaf72
5 changed files with 35 additions and 4 deletions
@@ -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.
@@ -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.