Fixes #5051 (introduced in #4684), effectively allowing underscores in address literals.

This commit is contained in:
Christian Parpart
2018-10-02 15:37:15 +02:00
committed by Christian Parpart
parent 7609710d4f
commit 9fb835b710
5 changed files with 14 additions and 6 deletions
+2 -2
View File
@@ -2398,11 +2398,11 @@ void TypeChecker::endVisit(Literal const& _literal)
_literal.annotation().type = make_shared<AddressType>(StateMutability::Payable);
string msg;
if (_literal.value().length() != 42) // "0x" + 40 hex digits
if (_literal.valueWithoutUnderscores().length() != 42) // "0x" + 40 hex digits
// looksLikeAddress enforces that it is a hex literal starting with "0x"
msg =
"This looks like an address but is not exactly 40 hex digits. It is " +
to_string(_literal.value().length() - 2) +
to_string(_literal.valueWithoutUnderscores().length() - 2) +
" hex digits.";
else if (!_literal.passesAddressChecksum())
{