mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add test cases for shadowing gasleft with local functions/variables.
This commit is contained in:
parent
298bdeec49
commit
29fb5fe1c9
@ -7434,6 +7434,25 @@ BOOST_AUTO_TEST_CASE(gas_left)
|
|||||||
CHECK_ERROR(text, TypeError, "Member \"gas\" not found or not visible after argument-dependent lookup in msg");
|
CHECK_ERROR(text, TypeError, "Member \"gas\" not found or not visible after argument-dependent lookup in msg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(gasleft_as_identifier)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract C {
|
||||||
|
function gasleft() public pure returns (bytes32 val) { return "abc"; }
|
||||||
|
function f() public pure { bytes32 val = gasleft(); assert (val == "abc"); }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_WARNING(text, "This declaration shadows a builtin symbol.");
|
||||||
|
|
||||||
|
text = R"(
|
||||||
|
contract C {
|
||||||
|
uint gasleft;
|
||||||
|
function f() public { gasleft = 42; }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_WARNING(text, "This declaration shadows a builtin symbol.");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(builtin_reject_value)
|
BOOST_AUTO_TEST_CASE(builtin_reject_value)
|
||||||
{
|
{
|
||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
|
Loading…
Reference in New Issue
Block a user