diff options
author | chriseth <c@ethdev.com> | 2015-11-17 07:06:57 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-11-26 20:10:12 +0800 |
commit | 30b325fdc148d5014f04fd238362e3a1df10310f (patch) | |
tree | cd8df0c1f6e5462f2349a07d8f5f7d1fd156b4cc /test/libsolidity | |
parent | cd94aa978a77ace1296f9978bfae6d8735b5c91d (diff) | |
download | dexon-solidity-30b325fdc148d5014f04fd238362e3a1df10310f.tar.gz dexon-solidity-30b325fdc148d5014f04fd238362e3a1df10310f.tar.zst dexon-solidity-30b325fdc148d5014f04fd238362e3a1df10310f.zip |
Allow "new expressions" also for general type names.
Breaking change: If you want to send value with a contract creation, you
have to use parentheses now:
`(new ContractName).value(2 ether)(arg1, arg2)`
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 93b42c51..681ab107 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1955,7 +1955,7 @@ BOOST_AUTO_TEST_CASE(value_for_constructor) contract Main { Helper h; function Main() { - h = new Helper.value(10)("abc", true); + h = (new Helper).value(10)("abc", true); } function getFlag() returns (bool ret) { return h.getFlag(); } function getName() returns (bytes3 ret) { return h.getName(); } diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index e87e47a8..3d9dc5b5 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -2529,6 +2529,24 @@ BOOST_AUTO_TEST_CASE(member_access_parser_ambiguity) BOOST_CHECK(success(text)); } +BOOST_AUTO_TEST_CASE(create_memory_arrays) +{ + char const* text = R"( + library L { + struct R { uint[10][10] y; } + struct S { uint a; uint b; uint[20][20][20] c; R d; } + } + contract C { + function f(uint size) { + L.S[][] x = new L.S[][](10); + var y = new uint[](20); + var z = new bytes(size); + } + } + )"; + BOOST_CHECK(success(text)); +} + BOOST_AUTO_TEST_SUITE_END() } |