mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow calldata structs.
This commit is contained in:
committed by
chriseth
parent
d3270bc311
commit
610ef9f199
@@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(enum_external_type)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(external_structs)
|
||||
BOOST_AUTO_TEST_CASE(external_struct_signatures)
|
||||
{
|
||||
char const* text = R"(
|
||||
pragma experimental ABIEncoderV2;
|
||||
@@ -213,7 +213,10 @@ BOOST_AUTO_TEST_CASE(external_structs)
|
||||
function i(Nested[] calldata) external {}
|
||||
}
|
||||
)";
|
||||
SourceUnit const* sourceUnit = parseAndAnalyse(text);
|
||||
// Ignore analysis errors. This test only checks that correct signatures
|
||||
// are generated for external structs, but they are not yet supported
|
||||
// in code generation and therefore cause an error in the TypeChecker.
|
||||
SourceUnit const* sourceUnit = parseAnalyseAndReturnError(text, false, true, true).first;
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
|
||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||
{
|
||||
@@ -226,7 +229,7 @@ BOOST_AUTO_TEST_CASE(external_structs)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(external_structs_in_libraries)
|
||||
BOOST_AUTO_TEST_CASE(external_struct_signatures_in_libraries)
|
||||
{
|
||||
char const* text = R"(
|
||||
pragma experimental ABIEncoderV2;
|
||||
@@ -241,7 +244,10 @@ BOOST_AUTO_TEST_CASE(external_structs_in_libraries)
|
||||
function i(Nested[] calldata) external {}
|
||||
}
|
||||
)";
|
||||
SourceUnit const* sourceUnit = parseAndAnalyse(text);
|
||||
// Ignore analysis errors. This test only checks that correct signatures
|
||||
// are generated for external structs, but calldata structs are not yet supported
|
||||
// in code generation and therefore cause an error in the TypeChecker.
|
||||
SourceUnit const* sourceUnit = parseAnalyseAndReturnError(text, false, true, true).first;
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
|
||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user