Allow global enum definitions.

This commit is contained in:
Daniel Kirchner
2019-09-02 11:52:51 +02:00
parent fae0e10d26
commit 2b938d703c
8 changed files with 50 additions and 1 deletions
@@ -0,0 +1,7 @@
enum E { A }
contract C {
function f() public pure {
E e = E.A;
e;
}
}
@@ -0,0 +1,4 @@
enum E { A }
contract E {}
// ----
// DeclarationError: (13-26): Identifier already declared.
@@ -0,0 +1,4 @@
enum E { A }
enum E { A }
// ----
// DeclarationError: (13-25): Identifier already declared.
@@ -0,0 +1,10 @@
enum E { A }
contract C {
enum E { A }
function f() public pure {
E e = E.A;
e;
}
}
// ----
// Warning: (30-42): This declaration shadows an existing declaration.
@@ -0,0 +1,7 @@
==== Source: a ====
enum E { A }
==== Source: b ====
import "a";
enum E { A }
// ----
// DeclarationError: (b:12-24): Identifier already declared.
@@ -0,0 +1,7 @@
==== Source: a ====
enum E { A }
==== Source: b ====
import "a";
contract E { }
// ----
// DeclarationError: (b:12-26): Identifier already declared.
@@ -0,0 +1,7 @@
==== Source: a ====
enum E { A }
==== Source: b ====
import "a";
struct E { uint256 a; }
// ----
// DeclarationError: (b:12-35): Identifier already declared.