Skip to content

feat: rust-style beautiful error messages#199

Merged
cs01 merged 2 commits intomainfrom
beautiful-errors
Mar 11, 2026
Merged

feat: rust-style beautiful error messages#199
cs01 merged 2 commits intomainfrom
beautiful-errors

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 11, 2026

Summary

  • Compile errors now display Rust-style formatting with source code context, line numbers, colored underlines pointing to the exact token, and help/note annotations
  • Before: error: class 'User' has uninitialized field 'name' — assign a value...
  • After:
error: class 'User' has uninitialized field 'name'
   --> file.ts:2:3
   |
 2 |   name: string;
   |   ^~~~
   |
   = help: assign a value in the field declaration or constructor
  • All 4 semantic passes (closure mutation, union types, type assertions, uninitialized fields) now use the shared formatCompileError() formatter
  • Fixed a bug where entryFileCode wasn't found for relative input paths (abs path comparison mismatch)
  • Uninitialized field errors now point to the field declaration line, not the class line

Test plan

  • All 458 tests pass
  • Self-hosting passes (Stage 0 + Stage 1)
  • Native compiler builds successfully
  • Compile error test fixtures still match expected substrings

🤖 Generated with Claude Code

cs01 and others added 2 commits March 10, 2026 17:12
…erlines

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cs01 cs01 merged commit 0395b1c into main Mar 11, 2026
12 checks passed
@cs01 cs01 deleted the beautiful-errors branch March 12, 2026 05:34
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.

1 participant