-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Description
When compilation fails due to internal type mismatches, the error message exposes Cranelift internals:
declared type of variable var0 doesn't match type of value v0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This is confusing for users - they see Rust-specific terms like var0, v0, and RUST_BACKTRACE.
Expected Behavior
Error messages should be user-friendly and naml-specific:
- Show the actual variable name from the source code
- Show the expected vs actual types in naml terms
- Provide a helpful suggestion if possible
- Hide internal implementation details (Cranelift, Rust panic messages)
Example
Current:
declared type of variable var0 doesn't match type of value v0
Expected:
error: type mismatch for variable 'xx'
--> file.naml:1:17
|
1 | var xx: decimal = 1.0;
| ^^^^^^^ expected decimal, found float
|
help: decimal is not yet fully supported, use float instead
Scope
- Wrap Cranelift compilation in proper error handling
- Catch panics and convert to user-friendly errors
- Map internal variable names back to source names where possible
- Add span information to codegen errors for better source locations
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels