diff options
author | chriseth <chris@ethereum.org> | 2018-07-09 23:57:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-09 23:57:16 +0800 |
commit | ab99893396f9f237d40af1417723c9e83b9291d5 (patch) | |
tree | bdeb0a785ef665e9981fce11c36cb9d3079d9a67 /libsolidity | |
parent | e950fd434aa4394e669c7277ba229595e0a4bc08 (diff) | |
parent | 4747ef26fb752c413bf64483070a6c30584b7287 (diff) | |
download | dexon-solidity-ab99893396f9f237d40af1417723c9e83b9291d5.tar.gz dexon-solidity-ab99893396f9f237d40af1417723c9e83b9291d5.tar.zst dexon-solidity-ab99893396f9f237d40af1417723c9e83b9291d5.zip |
Merge pull request #4440 from ethereum/hex_denomination_enforce_error
[BREAKING] Enforce error on hex combined with denomination
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 676b3cd6..ed7f05f7 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2267,11 +2267,9 @@ 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()) { - // Assign type here if it even looks like an address. This prevents double error in 050 mode for invalid address + // Assign type here if it even looks like an address. This prevents double errors for invalid addresses _literal.annotation().type = make_shared<IntegerType>(160, IntegerType::Modifier::Address); string msg; @@ -2298,20 +2296,11 @@ void TypeChecker::endVisit(Literal const& _literal) } if (_literal.isHexNumber() && _literal.subDenomination() != Literal::SubDenomination::None) - { - if (v050) - m_errorReporter.fatalTypeError( - _literal.location(), - "Hexadecimal numbers cannot be used with unit denominations. " - "You can use an expression of the form \"0x1234 * 1 day\" instead." - ); - else - m_errorReporter.warning( - _literal.location(), - "Hexadecimal numbers with unit denominations are deprecated. " - "You can use an expression of the form \"0x1234 * 1 day\" instead." - ); - } + m_errorReporter.fatalTypeError( + _literal.location(), + "Hexadecimal numbers cannot be used with unit denominations. " + "You can use an expression of the form \"0x1234 * 1 day\" instead." + ); if (_literal.subDenomination() == Literal::SubDenomination::Year) m_errorReporter.typeError( |