diff options
author | chriseth <chris@ethereum.org> | 2017-06-23 17:56:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-23 17:56:24 +0800 |
commit | 1f7697eee318445e770d4e634477c38685af5110 (patch) | |
tree | 329139d9665742e7fb99661d9b0fd1129a7f7198 /libsolidity | |
parent | b00d7a6911e5378d8207a07e7df1ffaf23419c8c (diff) | |
parent | 0fb1621a983025d41ef05d1156bc167ce4490259 (diff) | |
download | dexon-solidity-1f7697eee318445e770d4e634477c38685af5110.tar dexon-solidity-1f7697eee318445e770d4e634477c38685af5110.tar.gz dexon-solidity-1f7697eee318445e770d4e634477c38685af5110.tar.bz2 dexon-solidity-1f7697eee318445e770d4e634477c38685af5110.tar.lz dexon-solidity-1f7697eee318445e770d4e634477c38685af5110.tar.xz dexon-solidity-1f7697eee318445e770d4e634477c38685af5110.tar.zst dexon-solidity-1f7697eee318445e770d4e634477c38685af5110.zip |
Merge pull request #2448 from federicobond/constant-addresses
Fix address literals not being treated as compile-time constants
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 4194e1c2..40853608 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1726,10 +1726,7 @@ void TypeChecker::endVisit(Literal const& _literal) if (_literal.looksLikeAddress()) { if (_literal.passesAddressChecksum()) - { _literal.annotation().type = make_shared<IntegerType>(0, IntegerType::Modifier::Address); - return; - } else m_errorReporter.warning( _literal.location(), @@ -1737,10 +1734,13 @@ void TypeChecker::endVisit(Literal const& _literal) "If this is not used as an address, please prepend '00'." ); } - _literal.annotation().type = Type::forLiteral(_literal); - _literal.annotation().isPure = true; + if (!_literal.annotation().type) + _literal.annotation().type = Type::forLiteral(_literal); + if (!_literal.annotation().type) m_errorReporter.fatalTypeError(_literal.location(), "Invalid literal value."); + + _literal.annotation().isPure = true; } bool TypeChecker::contractDependenciesAreCyclic( |