Disallow the years unit denomination properly

This commit is contained in:
Alex Beregszaszi 2018-06-21 00:01:40 +02:00
parent 32f2db780c
commit 72e87423db
7 changed files with 9 additions and 23 deletions

View File

@ -10,6 +10,7 @@ Breaking Changes:
* General: Disallow declaring empty structs.
* General: Disallow raw ``callcode`` (was already deprecated in 0.4.12). It is still possible to use it via inline assembly.
* General: Disallow ``sha3`` and ``suicide`` aliases.
* General: Disallow the ``years`` unit denomination (was already deprecated in 0.4.24)
* General: Introduce ``emit`` as a keyword instead of parsing it as identifier.
* General: New keywords: ``calldata``
* General: New reserved keywords: ``alias``, ``apply``, ``auto``, ``copyof``, ``define``, ``immutable``,

View File

@ -32,7 +32,7 @@ Due to the fact that leap seconds cannot be predicted, an exact calendar
library has to be updated by an external oracle.
.. note::
The suffix ``years`` has been deprecated due to the reasons above.
The suffix ``years`` has been deprecated due to the reasons above and cannot be used starting version 0.5.0.
These suffixes cannot be applied to variables. If you want to
interpret some input variable in e.g. days, you can do it in the following way::

View File

@ -2316,18 +2316,10 @@ void TypeChecker::endVisit(Literal const& _literal)
}
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."
);
}
m_errorReporter.typeError(
_literal.location(),
"Using \"years\" as a unit denomination is deprecated."
);
if (!_literal.annotation().type)
_literal.annotation().type = Type::forLiteral(_literal);

View File

@ -109,7 +109,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
uint renewalDate;
}
uint constant c_renewalInterval = 1 years;
uint constant c_renewalInterval = 365 days;
uint constant c_freeBytes = 12;
function Registrar() {

View File

@ -1,7 +1,6 @@
contract C {
uint constant a = 1 wei + 2 szabo + 3 finney + 4 ether;
uint constant b = 1 seconds + 2 minutes + 3 hours + 4 days + 5 weeks + 6 years;
uint constant b = 1 seconds + 2 minutes + 3 hours + 4 days + 5 weeks;
uint constant c = 2 szabo / 1 seconds + 3 finney * 3 hours;
}
// ----
// Warning: (142-149): Using "years" as a unit denomination is deprecated.

View File

@ -2,4 +2,4 @@ contract C {
uint constant a = 3 years;
}
// ----
// Warning: (32-39): Using "years" as a unit denomination is deprecated.
// TypeError: (32-39): Using "years" as a unit denomination is deprecated.

View File

@ -1,6 +0,0 @@
pragma experimental "v0.5.0";
contract C {
uint constant a = 3 years;
}
// ----
// TypeError: (62-69): Using "years" as a unit denomination is deprecated.