From 30b325fdc148d5014f04fd238362e3a1df10310f Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 17 Nov 2015 00:06:57 +0100 Subject: 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)` --- test/libsolidity/SolidityEndToEndTest.cpp | 2 +- test/libsolidity/SolidityNameAndTypeResolution.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'test') 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() } -- cgit