mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow global struct definitions.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
struct S { uint256 a; uint256 b; }
|
||||
contract C {
|
||||
function f(S calldata s) external pure returns (uint256, uint256) {
|
||||
return (s.a, s.b);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f((uint256,uint256)): 42, 23 -> 42, 23
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user