mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4731 from ethereum/interface-enum
Allow enums in interfaces
This commit is contained in:
@@ -2,4 +2,3 @@ interface I {
|
||||
enum A { B, C }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (18-33): Enumerable cannot be declared in interfaces.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
interface I {
|
||||
enum Direction { Left, Right }
|
||||
}
|
||||
|
||||
contract D {
|
||||
function f() public pure returns (I.Direction) {
|
||||
return I.Direction.Left;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
library L {
|
||||
enum Direction { Left, Right }
|
||||
}
|
||||
|
||||
contract D {
|
||||
function f() public pure returns (L.Direction) {
|
||||
return L.Direction.Left;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
enum Direction { Left, Right }
|
||||
}
|
||||
|
||||
contract D is C {
|
||||
function f() public pure returns (Direction) {
|
||||
return Direction.Left;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
interface I {
|
||||
enum Direction { Left, Right }
|
||||
}
|
||||
|
||||
contract D is I {
|
||||
function f() public pure returns (Direction) {
|
||||
return Direction.Left;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user