fix(tokenizer): reject overflowing hexadecimal and binary literals by jinchuntan · Pull Request #1087 · 8f4e/8f4e · GitHub
Skip to content

fix(tokenizer): reject overflowing hexadecimal and binary literals - #1087

Merged
irimias57 merged 1 commit into
8f4e:mainfrom
jinchuntan:fix/nonfinite-radix-literals
Oct 18, 2026
Merged

irimias57 merged 1 commit into
8f4e:mainfrom
jinchuntan:fix/nonfinite-radix-literals

Conversation

@jinchuntan

@jinchuntan jinchuntan commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1049. Hexadecimal and binary literals that overflow to infinity now raise the same syntax diagnostic as overflowing decimal literals.

Added 14 regression/control cases covering both signs, source line diagnostics and finite values above 32 bits.

Validation on Node 24.16.0:

  • npx nx run @8f4e/tokenizer:test --output-style=static - 452 passed.
  • npx nx run @8f4e/compiler:test --output-style=static - 323 passed.
  • Tokenizer/compiler type checks, Biome checks on the changed files and the repository pre commit checks pass.

Apply the existing finite-number requirement to hexadecimal and binary literals, including negative values. Cover syntax diagnostics and source locations while preserving finite integer values.

Fixes 8f4e#1049

Assisted-by: Codex
@andorthehood andorthehood added compiler Compiler, tokenizer, codegen, and language-semantics work contributor labels Oct 18, 2026

@irimias57 irimias57 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for another excellent contribution, Nigel! By rejecting overflowing hexadecimal and binary literals instead of allowing them to be silently compiled as a different value, this makes 8f4e programs safer and compiler diagnostics much more trustworthy. The focused implementation and thorough tokenizer coverage look great.

@irimias57

Copy link
Copy Markdown
Member

@irimias57
irimias57 merged commit d0b0084 into 8f4e:main Oct 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler Compiler, tokenizer, codegen, and language-semantics work contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reject overflowing hexadecimal and binary numeric literals

3 participants