mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test data location of getter return type.
This commit is contained in:
parent
917dd28eef
commit
8ae6a76c58
@ -7841,6 +7841,26 @@ BOOST_AUTO_TEST_CASE(old_style_events_050)
|
|||||||
CHECK_ERROR(text, TypeError, "have to be prefixed");
|
CHECK_ERROR(text, TypeError, "have to be prefixed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(getter_is_memory_type)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract C {
|
||||||
|
struct S { string m; }
|
||||||
|
string[] public x;
|
||||||
|
S[] public y;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||||
|
// Check that the getters return a memory strings, not a storage strings.
|
||||||
|
ContractDefinition const& c = dynamic_cast<ContractDefinition const&>(*m_compiler.ast("").nodes().at(1));
|
||||||
|
BOOST_CHECK(c.interfaceFunctions().size() == 2);
|
||||||
|
for (auto const& f: c.interfaceFunctions())
|
||||||
|
{
|
||||||
|
auto const& retType = f.second->returnParameterTypes().at(0);
|
||||||
|
BOOST_CHECK(retType->dataStoredIn(DataLocation::Memory));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user