Correctly parse ambiguities like A.B[10] x and x.y[10] = 3.

This commit is contained in:
chriseth
2015-10-16 16:12:25 +02:00
parent 452d473293
commit 87079bd3fd
4 changed files with 99 additions and 27 deletions
@@ -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()
}
+18
View File
@@ -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()
}