aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-03-07 02:13:55 +0800
committerGitHub <noreply@github.com>2018-03-07 02:13:55 +0800
commitba8819542fa2e4f0079323e6fefd0ba6ee9ea916 (patch)
treea892e782d11f389c9f1950142af1b81c08f5595f /libsolidity
parentbaa152653916ef131f0f738431cbf2fd2bbb0408 (diff)
parent1ceb0b04c1ce117366cde88eb8c3bebb1a5e9598 (diff)
downloaddexon-solidity-ba8819542fa2e4f0079323e6fefd0ba6ee9ea916.tar.gz
dexon-solidity-ba8819542fa2e4f0079323e6fefd0ba6ee9ea916.tar.zst
dexon-solidity-ba8819542fa2e4f0079323e6fefd0ba6ee9ea916.zip
Merge pull request #3611 from ethereum/warn-using-address-overload
Warn if using address overloads on contracts
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 8279da05..bebdb9b6 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1858,6 +1858,20 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
if (exprType->category() == Type::Category::Contract)
{
+ // 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))
+ if (addressMember.name == memberName && *annotation.type == *addressMember.type)
+ {
+ solAssert(!v050, "Address member still present on contract in v0.5.0.");
+ 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();