You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preserve source spans through tokens, AST, and typed HIR #406
enhancementA request for a new feature or improvement.help wantedThe issue requires extra attention or help from others.technical debtIssues that represent potential future improvements or problems.
Lexer tokens currently retain only a line number, and later parser/semantic diagnostics often recover locations by scanning source text for a matching spelling. Repeated identifiers and nested expressions can therefore point at the wrong occurrence. The new typed HIR has stable expression and pattern identities but no first-class source span.
Contract
Introduce a backend-neutral source span that records byte start/end plus line/column information sufficient for human and JSON diagnostics. Preserve it through:
lexer tokens;
declarations, statements, expressions, and match patterns;
import expansion and generic monomorphization;
TypedProgram expression and pattern identities.
Synthetic nodes created during expansion must carry explicit provenance rather than pretending to be at line 1.
Scope
Define the span/provenance types and ownership model.
Thread spans through frontend construction and transformations.
Replace heuristic source-text lookup in diagnostics incrementally.
Add regressions with repeated identical spellings on one line and across imported modules.
Keep source spans independent of LLVM debug information.
Completion criteria
Every user-written AST/HIR node can report its original file and byte range.
Imported and monomorphized nodes retain useful origin information.
Diagnostics select the exact repeated occurrence.
UTF-8 columns remain correct.
No backend crate type leaks into the frontend span API.
Reconfirmed during the alpha-readiness audit following #474. Parser diagnostics still originate from line-only tokens and commonly report column 1; the nested-block boolean reproducer, for example, points to the start of the function rather than the rejected semicolon. This remains part of the alpha stabilization plan, and no duplicate issue was opened.
enhancementA request for a new feature or improvement.help wantedThe issue requires extra attention or help from others.technical debtIssues that represent potential future improvements or problems.
Activity
LunaStev commentedon Sep 5, 2026
Reconfirmed during the alpha-readiness audit following #474. Parser diagnostics still originate from line-only tokens and commonly report column 1; the nested-block boolean reproducer, for example, points to the start of the function rather than the rejected semicolon. This remains part of the alpha stabilization plan, and no duplicate issue was opened.