aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-24 18:12:03 +0800
committerGitHub <noreply@github.com>2018-04-24 18:12:03 +0800
commitd1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9 (patch)
treee389bf6c004e88917e91e6c93669b058ac129521 /libsolidity
parent258ae8927e21cddc18935e26b4184a833c85bda8 (diff)
parent1ac0090f31d12a720950991ab4e85710877effd1 (diff)
downloaddexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.tar.gz
dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.tar.zst
dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.zip
Merge pull request #3981 from ethereum/years-suffix
The "year" denomination is deprecated
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index ce98eb24..7ea10c5b 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -2233,6 +2233,7 @@ 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)
@@ -2248,6 +2249,21 @@ void TypeChecker::endVisit(Literal const& _literal)
"You can use an expression of the form \"0x1234 * 1 day\" instead."
);
}
+
+ if (_literal.subDenomination() == Literal::SubDenomination::Year)
+ {
+ if (v050)
+ m_errorReporter.typeError(
+ _literal.location(),
+ "Using \"years\" as a unit denomination is deprecated."
+ );
+ else
+ m_errorReporter.warning(
+ _literal.location(),
+ "Using \"years\" as a unit denomination is deprecated."
+ );
+ }
+
if (!_literal.annotation().type)
_literal.annotation().type = Type::forLiteral(_literal);