Warn if using address overloads on contracts

This commit is contained in:
Alex Beregszaszi
2018-03-05 15:50:27 +01:00
committed by chriseth
parent cd6ffbdf79
commit fd60c1cf86
4 changed files with 181 additions and 11 deletions
+10
View File
@@ -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();