diff options
author | Leonardo Alt <leo@ethereum.org> | 2018-07-05 21:48:57 +0800 |
---|---|---|
committer | Leonardo Alt <leo@ethereum.org> | 2018-07-09 23:19:41 +0800 |
commit | c1b67a845b7327e58ecf8fd8502750fbdb378e6e (patch) | |
tree | 0eec11152525d8817cc079044549a58f177c2ab7 /libsolidity | |
parent | 694754b4fe410abfa0661e29dd3e6d4d1ea1283e (diff) | |
download | dexon-solidity-c1b67a845b7327e58ecf8fd8502750fbdb378e6e.tar.gz dexon-solidity-c1b67a845b7327e58ecf8fd8502750fbdb378e6e.tar.zst dexon-solidity-c1b67a845b7327e58ecf8fd8502750fbdb378e6e.zip |
Enforce error on hex number combined with unit 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( |