-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
contract Variable { | ||
aUserType a_user_type; | ||
|
||
struct aUserType { | ||
uint aUserType; | ||
} | ||
|
||
function a_user_type_memory(aUserType memory a_user_type) public returns (uint) { | ||
return a_user_type.aUserType; | ||
} | ||
|
||
function a_user_type_calldata(aUserType calldata a_user_type) public returns (uint) { | ||
return a_user_type.aUserType; | ||
} | ||
|
||
function a_user_type_storage() public returns (uint) { | ||
aUserType storage a_user_type = a_user_type; | ||
return a_user_type.aUserType; | ||
} | ||
} | ||
|
||
contract B { | ||
struct A { | ||
address a; | ||
} | ||
} | ||
contract A is B { | ||
A a; // contract A | ||
|
||
function return_struct() external returns (A memory) { | ||
// a is of type B.A, *not* Contract::A | ||
a = A(address(this)); | ||
return a; | ||
} | ||
} | ||
|
||
contract C { | ||
C c; | ||
function return_contract() external returns (C) { | ||
// c is of type Contract::C | ||
c = C(address(this)); | ||
return c; | ||
} | ||
} |