diff options
author | chriseth <chris@ethereum.org> | 2018-02-27 00:14:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-27 00:14:30 +0800 |
commit | cd2d893634b490236ef29fe857556bde4901a74d (patch) | |
tree | 372ce26d91cc78fbd087f80816b0608326a9a3e1 /test | |
parent | 6b3a5e5d87230da076f1cac293e21e8d34036f03 (diff) | |
parent | 4da20bdf012d948a45cc99d137cf18ead65c0a30 (diff) | |
download | dexon-solidity-cd2d893634b490236ef29fe857556bde4901a74d.tar dexon-solidity-cd2d893634b490236ef29fe857556bde4901a74d.tar.gz dexon-solidity-cd2d893634b490236ef29fe857556bde4901a74d.tar.bz2 dexon-solidity-cd2d893634b490236ef29fe857556bde4901a74d.tar.lz dexon-solidity-cd2d893634b490236ef29fe857556bde4901a74d.tar.xz dexon-solidity-cd2d893634b490236ef29fe857556bde4901a74d.tar.zst dexon-solidity-cd2d893634b490236ef29fe857556bde4901a74d.zip |
Merge pull request #3588 from ethereum/fixGetterType
Fix getter type
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 27761066..93abee0d 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -7841,6 +7841,26 @@ BOOST_AUTO_TEST_CASE(old_style_events_050) 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() } |