mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Warn if using address overloads on contracts
This commit is contained in:
committed by
chriseth
parent
cd6ffbdf79
commit
fd60c1cf86
@@ -1831,6 +1831,16 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
||||
|
||||
if (exprType->category() == Type::Category::Contract)
|
||||
{
|
||||
// Warn about using address members on contracts
|
||||
for (auto const& addressMember: IntegerType(160, IntegerType::Modifier::Address).nativeMembers(nullptr))
|
||||
if (addressMember.name == memberName && *annotation.type == *addressMember.type)
|
||||
m_errorReporter.warning(
|
||||
_memberAccess.location(),
|
||||
"Using contract member \"" + memberName +"\" inherited from the address type is deprecated." +
|
||||
" Convert the contract to \"address\" type to access the member."
|
||||
);
|
||||
|
||||
// Warn about using send or transfer with a non-payable fallback function.
|
||||
if (auto callType = dynamic_cast<FunctionType const*>(type(_memberAccess).get()))
|
||||
{
|
||||
auto kind = callType->kind();
|
||||
|
||||
Reference in New Issue
Block a user