Skip to content

Conversation

@rtfeldman
Copy link
Contributor

@rtfeldman rtfeldman commented Jan 3, 2026

Summary

  • Fix invalid number literal suffix (like 0.F) to give proper "UNDECLARED TYPE" error instead of crashing
  • During canonicalization, check that the type suffix refers to a type that is actually in scope
  • If the type is not in scope, emit a proper diagnostic instead of creating a malformed expression that crashes later

Test plan

  • Added snapshot test number_suffix_undeclared_type.md that verifies 0.F produces "UNDECLARED TYPE" error
  • Verified 123.U64 still works correctly (U64 is in scope from Builtin imports)
  • zig build minici passes

🤖 Generated with Claude Code

When parsing number literals like `0.F`, the tokenizer produces
`Int,NoSpaceDotUpperIdent` which the parser interprets as a typed
integer with type suffix `.F`. Previously, this invalid type suffix
would cause a crash later in evaluation.

This commit adds validation during canonicalization to check that
the type suffix refers to a type that is actually in scope. If the
type is not in scope (like `F` in `0.F`), the expression is replaced
with e_runtime_error and a proper "UNDECLARED TYPE" diagnostic is
emitted.

Also includes a fix for the broken "check type - for mismatch" test
after the numeric suffix deprecation (from PR #8884).

Fixes #8893

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rtfeldman rtfeldman marked this pull request as ready for review January 3, 2026 13:34
@rtfeldman rtfeldman merged commit 0bc80c9 into main Jan 3, 2026
35 checks passed
@rtfeldman rtfeldman deleted the fix-issue-8893 branch January 3, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants