Add return data to bare calls.

This commit is contained in:
Daniel Kirchner
2018-09-04 13:31:10 +02:00
parent f27d7edfd6
commit 82f512a7d4
12 changed files with 269 additions and 119 deletions
@@ -438,7 +438,8 @@ BOOST_AUTO_TEST_CASE(address_staticcall)
char const* sourceCode = R"(
contract C {
function f() public view returns(bool) {
return address(0x4242).staticcall("");
(bool success,) = address(0x4242).staticcall("");
return success;
}
}
)";
@@ -464,6 +465,58 @@ BOOST_AUTO_TEST_CASE(address_staticcall_value)
}
}
BOOST_AUTO_TEST_CASE(address_call_full_return_type)
{
char const* sourceCode = R"(
contract C {
function f() public {
(bool success, bytes memory m) = address(0x4242).call("");
success; m;
}
}
)";
if (dev::test::Options::get().evmVersion().supportsReturndata())
CHECK_SUCCESS_NO_WARNINGS(sourceCode);
else
CHECK_ERROR(sourceCode, TypeError, "Type inaccessible dynamic type is not implicitly convertible to expected type bytes memory.");
}
BOOST_AUTO_TEST_CASE(address_delegatecall_full_return_type)
{
char const* sourceCode = R"(
contract C {
function f() public {
(bool success, bytes memory m) = address(0x4242).delegatecall("");
success; m;
}
}
)";
if (dev::test::Options::get().evmVersion().supportsReturndata())
CHECK_SUCCESS_NO_WARNINGS(sourceCode);
else
CHECK_ERROR(sourceCode, TypeError, "Type inaccessible dynamic type is not implicitly convertible to expected type bytes memory.");
}
BOOST_AUTO_TEST_CASE(address_staticcall_full_return_type)
{
if (dev::test::Options::get().evmVersion().hasStaticCall())
{
char const* sourceCode = R"(
contract C {
function f() public view {
(bool success, bytes memory m) = address(0x4242).staticcall("");
success; m;
}
}
)";
CHECK_SUCCESS_NO_WARNINGS(sourceCode);
}
}
BOOST_AUTO_TEST_SUITE_END()
}