mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8578 from ethereum/interface-function-modifier-error
Added error for interface functions that have modifiers; test case
This commit is contained in:
commit
216fca5b70
@ -303,7 +303,9 @@ bool SyntaxChecker::visit(FunctionDefinition const& _function)
|
||||
);
|
||||
}
|
||||
|
||||
if (!_function.isImplemented() && !_function.modifiers().empty())
|
||||
if (m_isInterface && !_function.modifiers().empty())
|
||||
m_errorReporter.syntaxError(_function.location(), "Functions in interfaces cannot have modifiers.");
|
||||
else if (!_function.isImplemented() && !_function.modifiers().empty())
|
||||
m_errorReporter.syntaxError(_function.location(), "Functions without implementation cannot have modifiers.");
|
||||
|
||||
return true;
|
||||
|
@ -0,0 +1,6 @@
|
||||
interface I {
|
||||
function f() external m pure returns (uint);
|
||||
modifier m() { _; }
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (16-60): Functions in interfaces cannot have modifiers.
|
Loading…
Reference in New Issue
Block a user