mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update expectations for uninitialized internal function.
This commit is contained in:
@@ -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"(
|
||||
|
||||
+17
@@ -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
|
||||
+17
@@ -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
|
||||
Reference in New Issue
Block a user