Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFE: Align handling of integer literals with the language spec #33311

alexmarkov opened this issue Jun 1, 2018 · 0 comments


2 participants
Copy link

commented Jun 1, 2018

After the recent revision dd83e69, language spec has the following wording:

A hexadecimal integer literal with numeric value $i$ is a compile-time
error if $i \ge{} 2^{64}$, unless it is prefixed by a unary minus operator,
in which case it is a compile-time error if $i \gt{} 2^{63}$.

@lrhn explained this as follows:

The underlying reasoning is that a - literal sequence is treated as evaluating to a single value directly, not by first evaluating the literal and then negating it. The full expression must produce a valid integer value.
We allow unsigend 64 bit hex literals as a special case, and only because it's a good way to represent the bits of a 64-bit integer.

Previous informal spec handled -literal as whole only for -9223372036854775808 decimal literal.

Handling of integer literals in CFE follows the informal spec and needs to be updated to align with the formal language spec. In particular, CFE should issue an error for hexadecimal literals >2^63 with unary minus, like -0xFFFFFFFFFFFFFFFF.

/cc @kmillikin

@askeksa-google askeksa-google added this to Triaged in Dart Front End Aug 14, 2018

@askeksa-google askeksa-google self-assigned this Sep 3, 2018

@askeksa-google askeksa-google moved this from Triaged to In Progress in Dart Front End Sep 18, 2018

@dart-bot dart-bot closed this in 8385c36 Sep 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.