mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Assert that address members are not present on contract types in 0.5.0.
This commit is contained in:
parent
fd60c1cf86
commit
1ceb0b04c1
@ -1832,13 +1832,17 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
|||||||
if (exprType->category() == Type::Category::Contract)
|
if (exprType->category() == Type::Category::Contract)
|
||||||
{
|
{
|
||||||
// Warn about using address members on contracts
|
// Warn about using address members on contracts
|
||||||
|
bool v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
|
||||||
for (auto const& addressMember: IntegerType(160, IntegerType::Modifier::Address).nativeMembers(nullptr))
|
for (auto const& addressMember: IntegerType(160, IntegerType::Modifier::Address).nativeMembers(nullptr))
|
||||||
if (addressMember.name == memberName && *annotation.type == *addressMember.type)
|
if (addressMember.name == memberName && *annotation.type == *addressMember.type)
|
||||||
|
{
|
||||||
|
solAssert(!v050, "Address member still present on contract in v0.5.0.");
|
||||||
m_errorReporter.warning(
|
m_errorReporter.warning(
|
||||||
_memberAccess.location(),
|
_memberAccess.location(),
|
||||||
"Using contract member \"" + memberName +"\" inherited from the address type is deprecated." +
|
"Using contract member \"" + memberName +"\" inherited from the address type is deprecated." +
|
||||||
" Convert the contract to \"address\" type to access the member."
|
" Convert the contract to \"address\" type to access the member."
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Warn about using send or transfer with a non-payable fallback function.
|
// Warn about using send or transfer with a non-payable fallback function.
|
||||||
if (auto callType = dynamic_cast<FunctionType const*>(type(_memberAccess).get()))
|
if (auto callType = dynamic_cast<FunctionType const*>(type(_memberAccess).get()))
|
||||||
|
Loading…
Reference in New Issue
Block a user