The spec does not limit the size of integer values; it is backend specific. For example, the Ceylon/JS Integer range extends well beyond that of Java's long.
Even for the JVM (64-bit Integer), the full range is not currently supported by ceylon.ast; -9223372036854775808 appearing in code results in an assertion error.
IntegerLiteral.integer is of type Integer, but should be Whole or String. I suggest we go with String for now (or simply remove the integer property?), and use Whole in 1.3 if Whole goes cross-platform.
The problem with the 64-bit min-long value is that in the tree, it is represented as a negated positive value:
and positive 9223372036854775808 is out of range on the JVM.
The stacktrace:
Exception in thread "main" ceylon.language.AssertionError "Assertion failed
violated exists _integer = parseInteger(radix == 10 then text else text.rest, radix)"
at ceylon.ast.core.IntegerLiteral.<init>(IntegerLiteral.ceylon:23)
at ceylon.ast.redhat.integerLiteralToCeylon_.integerLiteralToCeylon(IntegerLiteral.ceylon:21)
at ceylon.ast.redhat.literalToCeylon_.literalToCeylon(Literal.ceylon:35)
at ceylon.ast.redhat.atomToCeylon_.atomToCeylon(Atom.ceylon:33)
at ceylon.ast.redhat.primaryToCeylon_.primaryToCeylon(Primary.ceylon:38)
at ceylon.ast.redhat.valueExpressionToCeylon_.valueExpressionToCeylon(ValueExpression.ceylon:24)
General and specific issues:
long
.-9223372036854775808
appearing in code results in an assertion error.IntegerLiteral.integer
is of typeInteger
, but should beWhole
orString
. I suggest we go withString
for now (or simply remove theinteger
property?), and useWhole
in 1.3 ifWhole
goes cross-platform.The problem with the 64-bit min-long value is that in the tree, it is represented as a negated positive value:
and what would be:
and positive
9223372036854775808
is out of range on the JVM.The stacktrace: