aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-06-11 18:45:39 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-06-25 22:17:50 +0800
commit48b003d4d4e4ebddf8922fb06a47c1634203d0bc (patch)
tree13b8ff36b484d09ed5e83477125e33692584872b /libsolidity/analysis
parent51567c0513aaed7830e5f5474a625eb0a1475ad2 (diff)
downloaddexon-solidity-48b003d4d4e4ebddf8922fb06a47c1634203d0bc.tar.gz
dexon-solidity-48b003d4d4e4ebddf8922fb06a47c1634203d0bc.tar.zst
dexon-solidity-48b003d4d4e4ebddf8922fb06a47c1634203d0bc.zip
Better wording for invalid address literal error
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index e50464f4..14789979 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -2291,10 +2291,12 @@ void TypeChecker::endVisit(Literal const& _literal)
_literal.annotation().type = make_shared<IntegerType>(160, IntegerType::Modifier::Address);
if (_literal.value().length() != 42) // "0x" + 40 hex digits
+ // looksLikeAddress enforces that it is a hex literal starting with "0x"
m_errorReporter.syntaxError(
_literal.location(),
- "This looks like an address but is not exactly 20 bytes long. Current length is " +
- to_string(_literal.value().length()) + " (should be 42)."
+ "This looks like an address but is not exactly 40 hex digits. It is " +
+ to_string(_literal.value().length() - 2) +
+ " hex digits."
);
else if (!_literal.passesAddressChecksum())
m_errorReporter.syntaxError(