Merge pull request #4731 from ethereum/interface-enum

Allow enums in interfaces
This commit is contained in:
chriseth
2018-08-07 17:20:05 +02:00
committed by GitHub
10 changed files with 93 additions and 9 deletions
@@ -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;
}
}