diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-11 15:08:28 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-23 01:14:00 +0800 |
commit | bf7daf0814ac17fece679a9d1aa187a8bdcf901b (patch) | |
tree | 54a0d2556c61d5efb27f3bc12394429da70f7328 /test | |
parent | b003290638e16e595c25e433f2f65648ea6644da (diff) | |
download | dexon-solidity-bf7daf0814ac17fece679a9d1aa187a8bdcf901b.tar dexon-solidity-bf7daf0814ac17fece679a9d1aa187a8bdcf901b.tar.gz dexon-solidity-bf7daf0814ac17fece679a9d1aa187a8bdcf901b.tar.bz2 dexon-solidity-bf7daf0814ac17fece679a9d1aa187a8bdcf901b.tar.lz dexon-solidity-bf7daf0814ac17fece679a9d1aa187a8bdcf901b.tar.xz dexon-solidity-bf7daf0814ac17fece679a9d1aa187a8bdcf901b.tar.zst dexon-solidity-bf7daf0814ac17fece679a9d1aa187a8bdcf901b.zip |
[cond-expr] don't allow conditional as left value for the first stage
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 16 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 6 |
2 files changed, 4 insertions, 18 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 3b9b8449..be291735 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -128,22 +128,6 @@ BOOST_AUTO_TEST_CASE(conditional_expression_multiple) BOOST_CHECK(callContractFunction("f(uint256)", u256(40)) == toBigEndian(u256(10))); } -BOOST_AUTO_TEST_CASE(conditional_expression_as_left_value) -{ - char const* sourceCode = R"( - contract test { - function f(uint x) returns(uint d) { - uint y = 1; - uint z = 1; - (x > 10 ? y : z) = 3; - return y ** z; - } - })"; - compileAndRun(sourceCode); - BOOST_CHECK(callContractFunction("f(uint256)", u256(20)) == toBigEndian(u256(3))); - BOOST_CHECK(callContractFunction("f(uint256)", u256(5)) == toBigEndian(u256(1))); -} - BOOST_AUTO_TEST_CASE(conditional_expression_with_return_values) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 73f6a6c8..7cd92c9c 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -2972,12 +2972,14 @@ BOOST_AUTO_TEST_CASE(invalid_different_types_for_conditional_expression) BOOST_CHECK(expectError(text) == Error::Type::TypeError); } -BOOST_AUTO_TEST_CASE(invalid_left_value_in_conditional_expression) +BOOST_AUTO_TEST_CASE(left_value_in_conditional_expression_not_supported_yet) { char const* text = R"( contract C { function f() { - (true ? 3 : 5) = 1; + uint x; + uint y; + (true ? x : y) = 1; } } )"; |