diff options
author | chriseth <c@ethdev.com> | 2017-01-25 00:38:06 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2017-01-25 06:37:48 +0800 |
commit | 1316bb75651ea365c5246277d2dfd3d366be9070 (patch) | |
tree | 8c46bf1a45ca85bcd1da2d8ef8b2556e22cf5634 /libsolidity/analysis | |
parent | ba9a04500217e301bec63cab4e0c0f1d9322646d (diff) | |
download | dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.tar dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.tar.gz dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.tar.bz2 dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.tar.lz dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.tar.xz dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.tar.zst dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.zip |
Warn about invalid checksums of addresses.
Diffstat (limited to 'libsolidity/analysis')
-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 adb3d54f..533c787b 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1565,6 +1565,16 @@ void TypeChecker::endVisit(ElementaryTypeNameExpression const& _expr) void TypeChecker::endVisit(Literal const& _literal) { + if (_literal.looksLikeAddress()) + { + if (_literal.passesAddressChecksum()) + { + _literal.annotation().type = make_shared<IntegerType>(0, IntegerType::Modifier::Address); + return; + } + else + warning(_literal.location(), "This looks like an address but has an invalid checksum."); + } _literal.annotation().type = Type::forLiteral(_literal); if (!_literal.annotation().type) fatalTypeError(_literal.location(), "Invalid literal value."); |