Update expectations for uninitialized internal function.

This commit is contained in:
chriseth
2021-01-19 12:37:30 +01:00
parent 87a68feea1
commit c3d3415207
4 changed files with 53 additions and 18 deletions
-18
View File
@@ -5615,24 +5615,6 @@ BOOST_AUTO_TEST_CASE(event_wrong_abi_name)
)
}
BOOST_AUTO_TEST_CASE(uninitialized_internal_storage_function)
{
char const* sourceCode = R"(
contract Test {
function() internal x;
function f() public returns (uint r) {
function() internal t = x;
assembly { r := t }
}
}
)";
compileAndRun(sourceCode, 0, "Test");
bytes result = callContractFunction("f()");
BOOST_CHECK(!result.empty());
BOOST_CHECK(result != encodeArgs(0));
}
BOOST_AUTO_TEST_CASE(dirty_scratch_space_prior_to_constant_optimiser)
{
char const* sourceCode = R"(
@@ -0,0 +1,17 @@
contract Test {
function() internal x;
function f() public returns (bool) {
function() internal t = x;
// The legacy codegen would use a specific function
// entry tag that always panics.
// Via Yul, the internal dispatch will panic instead.
uint z;
assembly { z := t }
assert(z != 0);
return true;
}
}
// ====
// compileViaYul: false
// ----
// f() -> true
@@ -0,0 +1,17 @@
contract Test {
function() internal x;
function f() public returns (bool) {
function() internal t = x;
// The legacy codegen would use a specific function
// entry tag that always panics.
// Via Yul, the internal dispatch will panic instead.
uint z;
assembly { z := t }
assert(z == 0);
return true;
}
}
// ====
// compileViaYul: true
// ----
// f() -> true