Allow global struct definitions.

This commit is contained in:
Daniel Kirchner
2019-09-02 11:17:42 +02:00
parent 25a3a83b34
commit 872d21f527
8 changed files with 47 additions and 5 deletions
@@ -0,0 +1,4 @@
contract S {}
struct S { uint256 a; }
// ----
// DeclarationError: (14-37): Identifier already declared.
@@ -0,0 +1,7 @@
struct S { uint a; }
contract C {
function f() public pure {
S memory s = S(42);
s;
}
}
@@ -0,0 +1,4 @@
struct S { uint256 a; }
contract S {}
// ----
// DeclarationError: (24-37): Identifier already declared.
@@ -0,0 +1,10 @@
struct S { uint a; }
contract C {
struct S { address x; }
function f() public view {
S memory s = S(address(this));
s;
}
}
// ----
// Warning: (38-61): This declaration shadows an existing declaration.
@@ -0,0 +1,4 @@
struct S { uint256 a; }
struct S { uint256 a; }
// ----
// DeclarationError: (24-47): Identifier already declared.