diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-03-01 23:58:20 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-03-01 23:58:55 +0800 |
commit | bd4c2b9bde02b94d367ad9af6e44b9434bb1bb93 (patch) | |
tree | d5e7c0cf5e6e016f6c0ab391d6cda49a2150978a /libsolidity/analysis | |
parent | 9e3da89a7a0753e869b4668f9587385c9b37ba8d (diff) | |
download | dexon-solidity-bd4c2b9bde02b94d367ad9af6e44b9434bb1bb93.tar dexon-solidity-bd4c2b9bde02b94d367ad9af6e44b9434bb1bb93.tar.gz dexon-solidity-bd4c2b9bde02b94d367ad9af6e44b9434bb1bb93.tar.bz2 dexon-solidity-bd4c2b9bde02b94d367ad9af6e44b9434bb1bb93.tar.lz dexon-solidity-bd4c2b9bde02b94d367ad9af6e44b9434bb1bb93.tar.xz dexon-solidity-bd4c2b9bde02b94d367ad9af6e44b9434bb1bb93.tar.zst dexon-solidity-bd4c2b9bde02b94d367ad9af6e44b9434bb1bb93.zip |
Deprecate using unit denominations in combination with hex numbers. Closes #3574.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 2914472a..4ff0fb8f 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2021,6 +2021,8 @@ void TypeChecker::endVisit(ElementaryTypeNameExpression const& _expr) void TypeChecker::endVisit(Literal const& _literal) { + bool const v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050); + if (_literal.looksLikeAddress()) { if (_literal.passesAddressChecksum()) @@ -2034,6 +2036,19 @@ void TypeChecker::endVisit(Literal const& _literal) "For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals" ); } + if (_literal.isHexNumber() && _literal.subDenomination() != Literal::SubDenomination::None) + { + if (v050) + m_errorReporter.fatalTypeError( + _literal.location(), + "Hexadecimal numbers cannot be used with unit denominations." + ); + else + m_errorReporter.warning( + _literal.location(), + "Hexadecimal numbers with unit denominations are deprecated." + ); + } if (!_literal.annotation().type) _literal.annotation().type = Type::forLiteral(_literal); |