Skip to content

Conversation

@rtfeldman
Copy link
Contributor

Summary

  • Add deprecation error for old-style numeric suffixes like 123u64 or 3.14f64
  • The error suggests using the new syntax (e.g., 123.U64) instead
  • The old syntax still works but emits a deprecation diagnostic, allowing existing code to continue working while encouraging migration

Changes

  • Add deprecated_number_suffix diagnostic type to Diagnostic.zig
  • Add corresponding node tag and NodeStore handling
  • Emit deprecation errors in canonicalizer for int/frac expressions and patterns
  • Update tests to use type annotations instead of deprecated suffixes
  • Update snapshots to include deprecation warnings

Test plan

  • zig build test - All 2189 tests pass
  • zig build minici - All checks pass

🤖 Generated with Claude Code

rtfeldman and others added 5 commits January 1, 2026 15:32
Add deprecation error for old-style numeric suffixes like `123u64` or
`3.14f64`. The error suggests using the new syntax (e.g., `123.U64`)
instead.

The old syntax still works but emits a deprecation diagnostic. This
allows existing code to continue working while encouraging migration
to the new syntax.

Changes:
- Add deprecated_number_suffix diagnostic type
- Emit deprecation errors in canonicalizer for int/frac expressions and patterns
- Update tests to use type annotations instead of deprecated suffixes
- Update snapshots to include deprecation warnings

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Changed all test files from old suffix syntax (123u64, 3.14f64) to
  new syntax (123.U64, 3.14.F64)
- Added formatter support for typed_int and typed_frac expressions
- Updated f64_pattern_literal_error test to reflect that typed suffixes
  aren't supported in patterns (now shows parse errors instead of
  semantic errors)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This test was for typed suffixes in patterns, but typed suffixes
don't exist in pattern syntax. The "F64 NOT ALLOWED IN PATTERN"
error is already tested by pattern_f64_overflow.md using untyped
floats that exceed Dec precision.

🤖 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 02:42
@rtfeldman rtfeldman merged commit 7564b57 into main Jan 3, 2026
35 checks passed
@rtfeldman rtfeldman deleted the deprecate-numeric-suffix branch January 3, 2026 05:50
rtfeldman added a commit that referenced this pull request Jan 3, 2026
Update the test to use the new typed numeric suffix syntax (0.I64 instead
of 0u8) and correct the expected error type. This was broken in PR #8884.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
rtfeldman added a commit that referenced this pull request Jan 3, 2026
Update the test to use the new typed numeric suffix syntax (0.I64 instead
of 0u8) and correct the expected error type. This was broken in PR #8884.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
rtfeldman added a commit that referenced this pull request Jan 3, 2026
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 added a commit that referenced this pull request Jan 3, 2026
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>
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