mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Do not try to display checksummed address for too-short/long address literals
This commit is contained in:
parent
6ebc094474
commit
1d5dd909b4
@ -2000,8 +2000,8 @@ void TypeChecker::endVisit(Literal const& _literal)
|
||||
m_errorReporter.warning(
|
||||
_literal.location(),
|
||||
"This looks like an address but has an invalid checksum. "
|
||||
"If this is not used as an address, please prepend '00'. "
|
||||
"Correct checksummed address: '" + _literal.getChecksummedAddress() + "'. "
|
||||
"If this is not used as an address, please prepend '00'. " +
|
||||
(!_literal.getChecksummedAddress().empty() ? "Correct checksummed address: '" + _literal.getChecksummedAddress() + "'. " : "") +
|
||||
"For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals"
|
||||
);
|
||||
}
|
||||
|
@ -587,5 +587,7 @@ bool Literal::passesAddressChecksum() const
|
||||
std::string Literal::getChecksummedAddress() const
|
||||
{
|
||||
solAssert(isHexNumber(), "Expected hex number");
|
||||
if (value().length != 42)
|
||||
return string();
|
||||
return dev::getChecksummedAddress(value());
|
||||
}
|
||||
|
@ -1613,7 +1613,7 @@ public:
|
||||
bool looksLikeAddress() const;
|
||||
/// @returns true if it passes the address checksum test.
|
||||
bool passesAddressChecksum() const;
|
||||
/// @returns the checksummed version of an address
|
||||
/// @returns the checksummed version of an address (or empty string if not valid)
|
||||
std::string getChecksummedAddress() const;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user