Only warn about unused return in low-level functions.

This commit is contained in:
chriseth
2016-06-26 13:53:32 +02:00
parent cc6314cd01
commit 25a64c7f8f
2 changed files with 64 additions and 7 deletions
@@ -3760,7 +3760,7 @@ BOOST_AUTO_TEST_CASE(unused_return_value)
}
}
)";
BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
BOOST_CHECK(success(text));
}
BOOST_AUTO_TEST_CASE(unused_return_value_send)
@@ -3775,6 +3775,54 @@ BOOST_AUTO_TEST_CASE(unused_return_value_send)
BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
}
BOOST_AUTO_TEST_CASE(unused_return_value_call)
{
char const* text = R"(
contract test {
function f() {
address(0x12).call("abc");
}
}
)";
BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
}
BOOST_AUTO_TEST_CASE(unused_return_value_call_value)
{
char const* text = R"(
contract test {
function f() {
address(0x12).call.value(2)("abc");
}
}
)";
BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
}
BOOST_AUTO_TEST_CASE(unused_return_value_callcode)
{
char const* text = R"(
contract test {
function f() {
address(0x12).callcode("abc");
}
}
)";
BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
}
BOOST_AUTO_TEST_CASE(unused_return_value_delegatecall)
{
char const* text = R"(
contract test {
function f() {
address(0x12).delegatecall("abc");
}
}
)";
BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
}
BOOST_AUTO_TEST_SUITE_END()
}