diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-20 21:54:41 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-03-05 22:50:27 +0800 |
commit | fd60c1cf86e69931fda47bdd187f444550ca785f (patch) | |
tree | 793510c7aab2330b34940dab009403f897ab1413 /libsolidity | |
parent | cd6ffbdf790e4d3e4da2e7f3fba5524a2b8c3e1d (diff) | |
download | dexon-solidity-fd60c1cf86e69931fda47bdd187f444550ca785f.tar.gz dexon-solidity-fd60c1cf86e69931fda47bdd187f444550ca785f.tar.zst dexon-solidity-fd60c1cf86e69931fda47bdd187f444550ca785f.zip |
Warn if using address overloads on contracts
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 9846a0d0..ac8b2b63 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -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(); |