-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow modifier declarations and definitions in interfaces
- Loading branch information
Showing
11 changed files
with
71 additions
and
12 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
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
11 changes: 11 additions & 0 deletions
11
test/libsolidity/syntaxTests/modifiers/definition_in_contract.sol
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,11 @@ | ||
contract C { | ||
modifier m { _; } | ||
modifier mv virtual { _; } | ||
} | ||
|
||
abstract contract A { | ||
modifier m { _; } | ||
modifier mv virtual { _; } | ||
modifier muv virtual; | ||
} | ||
// ---- |
7 changes: 7 additions & 0 deletions
7
test/libsolidity/syntaxTests/modifiers/definition_in_contract_unimplemented.sol
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,7 @@ | ||
contract C { | ||
modifier mu; | ||
modifier muv virtual; | ||
} | ||
// ---- | ||
// TypeError 3656: (0-57): Contract "C" should be marked as abstract. | ||
// TypeError 8063: (17-29): Modifiers without implementation must be marked virtual. |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/syntaxTests/modifiers/definition_in_interface.sol
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,12 @@ | ||
interface I { | ||
modifier m { _; } | ||
modifier mu; | ||
modifier mv virtual { _; } | ||
modifier muv virtual; | ||
} | ||
// ---- | ||
// TypeError 6408: (18-35): Modifiers cannot be defined or declared in interfaces. | ||
// TypeError 6408: (40-52): Modifiers cannot be defined or declared in interfaces. | ||
// TypeError 8063: (40-52): Modifiers without implementation must be marked virtual. | ||
// TypeError 6408: (57-83): Modifiers cannot be defined or declared in interfaces. | ||
// TypeError 6408: (88-109): Modifiers cannot be defined or declared in interfaces. |
5 changes: 5 additions & 0 deletions
5
test/libsolidity/syntaxTests/modifiers/definition_in_library.sol
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,5 @@ | ||
library L { | ||
modifier mv virtual { _; } | ||
} | ||
// ---- | ||
// TypeError 3275: (16-42): Modifiers in a library cannot be virtual. |
7 changes: 7 additions & 0 deletions
7
test/libsolidity/syntaxTests/modifiers/definition_in_library_unimplemented.sol
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,7 @@ | ||
library L { | ||
modifier mu; | ||
modifier muv virtual; | ||
} | ||
// ---- | ||
// TypeError 8063: (16-28): Modifiers without implementation must be marked virtual. | ||
// TypeError 3275: (33-54): Modifiers in a library cannot be virtual. |
4 changes: 4 additions & 0 deletions
4
test/libsolidity/syntaxTests/modifiers/definition_in_library_virtual.sol
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,4 @@ | ||
library L { | ||
modifier m { _; } | ||
} | ||
// ---- |
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