mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2981 from ethereum/no-address-overload
Do not add members of address to contracts in experimental 0.5.0
This commit is contained in:
@@ -7100,6 +7100,64 @@ BOOST_AUTO_TEST_CASE(array_length_validation)
|
||||
CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(no_address_members_on_contract)
|
||||
{
|
||||
char const* text = R"(
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() {
|
||||
this.balance;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Member \"balance\" not found or not visible after argument-dependent lookup in contract");
|
||||
text = R"(
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() {
|
||||
this.transfer;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Member \"transfer\" not found or not visible after argument-dependent lookup in contract");
|
||||
text = R"(
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() {
|
||||
this.send;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Member \"send\" not found or not visible after argument-dependent lookup in contract");
|
||||
text = R"(
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() {
|
||||
this.call;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Member \"call\" not found or not visible after argument-dependent lookup in contract");
|
||||
text = R"(
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() {
|
||||
this.callcode;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Member \"callcode\" not found or not visible after argument-dependent lookup in contract");
|
||||
text = R"(
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() {
|
||||
this.delegatecall;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Member \"delegatecall\" not found or not visible after argument-dependent lookup in contract");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user