mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Annotate struct definitions with a recursive flag.
This commit is contained in:
@@ -184,6 +184,7 @@ BOOST_AUTO_TEST_CASE(type_identifiers)
|
||||
BOOST_CHECK_EQUAL(ContractType(c, true).identifier(), "t_super$_MyContract$$$_$2");
|
||||
|
||||
StructDefinition s(++id, {}, make_shared<string>("Struct"), {});
|
||||
s.annotation().recursive = false;
|
||||
BOOST_CHECK_EQUAL(s.type()->identifier(), "t_type$_t_struct$_Struct_$3_storage_ptr_$");
|
||||
|
||||
EnumDefinition e(++id, {}, make_shared<string>("Enum"), {});
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
contract C {
|
||||
struct S {
|
||||
uint a;
|
||||
function() external returns (S memory) sub;
|
||||
}
|
||||
function f() public pure returns (S memory) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -4,4 +4,3 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// TypeError: (37-64): Data location must be "memory" for parameter in function, but "storage" was given.
|
||||
// TypeError: (37-64): Internal type cannot be used for external function type.
|
||||
|
||||
@@ -4,4 +4,3 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// TypeError: (57-84): Data location must be "memory" for return parameter in function, but "storage" was given.
|
||||
// TypeError: (57-84): Internal type cannot be used for external function type.
|
||||
|
||||
Reference in New Issue
Block a user