-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: syntax checker for functions with modifiers (#164)
- Loading branch information
1 parent
fd68e05
commit a5b5253
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
abstract contract A { | ||
modifier x() { | ||
_; | ||
} | ||
|
||
function updateState() external virtual x; //~ERROR: functions without implementation cannot have modifiers | ||
} | ||
|
||
interface B { | ||
modifier x() { | ||
_; | ||
} | ||
|
||
function j() external x; //~ERROR: functions in interfaces cannot have modifiers | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: functions without implementation cannot have modifiers | ||
--> ROOT/tests/ui/resolve/func_modifiers.sol:LL:CC | ||
| | ||
LL | function updateState() external virtual x; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
|
||
error: functions in interfaces cannot have modifiers | ||
--> ROOT/tests/ui/resolve/func_modifiers.sol:LL:CC | ||
| | ||
LL | function j() external x; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
|
||
error: aborting due to 2 previous errors | ||
|