diff options
author | chriseth <c@ethdev.com> | 2015-10-16 22:12:14 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-10-16 22:12:25 +0800 |
commit | 87079bd3fdef496fc814a184cb3375e001b03a08 (patch) | |
tree | db4fc6b668892b7b25155362becf2b5ea56af556 /test | |
parent | 452d4732937f418d9c0b5152050c13aa48b7fdde (diff) | |
download | dexon-solidity-87079bd3fdef496fc814a184cb3375e001b03a08.tar.gz dexon-solidity-87079bd3fdef496fc814a184cb3375e001b03a08.tar.zst dexon-solidity-87079bd3fdef496fc814a184cb3375e001b03a08.zip |
Correctly parse ambiguities like `A.B[10] x` and `x.y[10] = 3`.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 21 | ||||
-rw-r--r-- | test/libsolidity/SolidityParser.cpp | 18 |
2 files changed, 39 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 5002cc4f..4f0b70bd 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -2505,6 +2505,27 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_6) BOOST_CHECK(expectError(text) == Error::Type::TypeError); } +BOOST_AUTO_TEST_CASE(member_access_parser_ambiguity) +{ + char const* text = R"( + contract C { + struct R { uint[10][10] y; } + struct S { uint a; uint b; uint[20][20][20] c; R d; } + S data; + function f() { + C.S x = data; + C.S memory y; + C.S[10] memory z; + C.S[10]; + y.a = 2; + x.c[1][2][3] = 9; + x.d.y[2][2] = 3; + } + } + )"; + BOOST_CHECK(success(text)); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index c181ae7e..77582a2a 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -1015,6 +1015,24 @@ BOOST_AUTO_TEST_CASE(tuples) BOOST_CHECK(successParse(text)); } +BOOST_AUTO_TEST_CASE(member_access_parser_ambiguity) +{ + char const* text = R"( + contract C { + struct S { uint a; uint b; uint[][][] c; } + function f() { + C.S x; + C.S memory y; + C.S[10] memory z; + C.S[10](x); + x.a = 2; + x.c[1][2][3] = 9; + } + } + )"; + BOOST_CHECK(successParse(text)); +} + BOOST_AUTO_TEST_SUITE_END() } |