Skip to content

Parser: do not create empty integer literals - #27126

Merged
SolalPirelli merged 2 commits into
scala:mainfrom
dotty-staging:solal/highlight-broken-lit
Sep 22, 2026
Merged

SolalPirelli merged 2 commits into
scala:mainfrom
dotty-staging:solal/highlight-broken-lit

Conversation

@SolalPirelli

Copy link
Copy Markdown
Contributor

Fixes #27122

Have you relied on LLM-based tools in this contribution?

No

How was the solution tested?

New automated tests (including the issue's reproducer, if applicable)

@SolalPirelli
SolalPirelli force-pushed the solal/highlight-broken-lit branch from 806a496 to 439a5eb Compare September 22, 2026 08:23
@SolalPirelli
SolalPirelli force-pushed the solal/highlight-broken-lit branch from 439a5eb to 960e8c1 Compare September 22, 2026 08:56
@SolalPirelli SolalPirelli added the needs-squashing PR whose commits should be squashed by the author or via the "Squash and Merge" button label Sep 22, 2026

@som-snytt som-snytt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I checked that - 0x. doesn't throw when warning and patching the span.

val d = digits
if d.isEmpty then
syntaxError(IllegalLiteral(), start)
Literal(Constant.fromValue(null))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between EmptyTree and a fabrication?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the same return value already used elsewhere in the function to indicate trouble. I don't have any particular opinion on what it should be ^^'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has the advantage of being totally lit!

@som-snytt som-snytt removed their assignment Sep 22, 2026
@SolalPirelli
SolalPirelli merged commit 4cf8dc0 into scala:main Sep 22, 2026
64 checks passed
@SolalPirelli
SolalPirelli deleted the solal/highlight-broken-lit branch September 22, 2026 19:24
@WojciechMazur WojciechMazur added this to the 3.10.1 milestone Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-squashing PR whose commits should be squashed by the author or via the "Squash and Merge" button

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Highlighting crash on 0x.

3 participants