Validate each tuple literal

This commit is contained in:
Alex Beregszaszi
2017-10-17 18:59:01 +02:00
committed by chriseth
parent c67b559ead
commit c99d2aae04
3 changed files with 39 additions and 1 deletions
@@ -5537,7 +5537,7 @@ BOOST_AUTO_TEST_CASE(invalid_mobile_type)
}
}
)";
CHECK_ERROR(text, TypeError, "Invalid mobile type.");
CHECK_ERROR(text, TypeError, "Invalid rational number.");
}
BOOST_AUTO_TEST_CASE(warns_msg_value_in_non_payable_public_function)
@@ -7096,6 +7096,37 @@ BOOST_AUTO_TEST_CASE(non_external_fallback)
CHECK_ERROR(text, TypeError, "Fallback function must be defined as \"external\".");
}
BOOST_AUTO_TEST_CASE(invalid_literal_in_tuple)
{
char const* text = R"(
contract C {
function f() pure public {
uint x;
(x, ) = (1E111);
}
}
)";
CHECK_ERROR(text, TypeError, "Invalid rational number.");
text = R"(
contract C {
function f() pure public {
uint x;
(x, ) = (1, 1E111);
}
}
)";
CHECK_ERROR(text, TypeError, "Invalid rational number.");
text = R"(
contract C {
function f() pure public {
uint x;
(x, ) = (1E111, 1);
}
}
)";
CHECK_ERROR(text, TypeError, "Invalid rational number.");
}
BOOST_AUTO_TEST_CASE(warn_about_sha3)
{
char const* text = R"(