-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4731 from ethereum/interface-enum
Allow enums in interfaces
- Loading branch information
Showing
10 changed files
with
93 additions
and
9 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
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 |
---|---|---|
|
@@ -2,4 +2,3 @@ interface I { | |
enum A { B, C } | ||
} | ||
// ---- | ||
// TypeError: (18-33): Enumerable cannot be declared in interfaces. |
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,9 @@ | ||
interface I { | ||
enum Direction { Left, Right } | ||
} | ||
|
||
contract D { | ||
function f() public pure returns (I.Direction) { | ||
return I.Direction.Left; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/syntaxTests/parsing/enum_from_interface_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,12 @@ | ||
interface I { | ||
enum Direction { Left, Right } | ||
} | ||
|
||
library L { | ||
function f() public pure returns (I.Direction) { | ||
return I.Direction.Left; | ||
} | ||
function g() internal pure returns (I.Direction) { | ||
return I.Direction.Left; | ||
} | ||
} |
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,9 @@ | ||
library L { | ||
enum Direction { Left, Right } | ||
} | ||
|
||
contract D { | ||
function f() public pure returns (L.Direction) { | ||
return L.Direction.Left; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/libsolidity/syntaxTests/parsing/enum_inheritance_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,9 @@ | ||
contract C { | ||
enum Direction { Left, Right } | ||
} | ||
|
||
contract D is C { | ||
function f() public pure returns (Direction) { | ||
return Direction.Left; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/libsolidity/syntaxTests/parsing/enum_inheritance_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,9 @@ | ||
interface I { | ||
enum Direction { Left, Right } | ||
} | ||
|
||
contract D is I { | ||
function f() public pure returns (Direction) { | ||
return Direction.Left; | ||
} | ||
} |