mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Better wording for invalid address literal error
This commit is contained in:
parent
51567c0513
commit
48b003d4d4
@ -2291,10 +2291,12 @@ void TypeChecker::endVisit(Literal const& _literal)
|
|||||||
_literal.annotation().type = make_shared<IntegerType>(160, IntegerType::Modifier::Address);
|
_literal.annotation().type = make_shared<IntegerType>(160, IntegerType::Modifier::Address);
|
||||||
|
|
||||||
if (_literal.value().length() != 42) // "0x" + 40 hex digits
|
if (_literal.value().length() != 42) // "0x" + 40 hex digits
|
||||||
|
// looksLikeAddress enforces that it is a hex literal starting with "0x"
|
||||||
m_errorReporter.syntaxError(
|
m_errorReporter.syntaxError(
|
||||||
_literal.location(),
|
_literal.location(),
|
||||||
"This looks like an address but is not exactly 20 bytes long. Current length is " +
|
"This looks like an address but is not exactly 40 hex digits. It is " +
|
||||||
to_string(_literal.value().length()) + " (should be 42)."
|
to_string(_literal.value().length() - 2) +
|
||||||
|
" hex digits."
|
||||||
);
|
);
|
||||||
else if (!_literal.passesAddressChecksum())
|
else if (!_literal.passesAddressChecksum())
|
||||||
m_errorReporter.syntaxError(
|
m_errorReporter.syntaxError(
|
||||||
|
Loading…
Reference in New Issue
Block a user