julia
fbc6b333 - [JuliaSyntax] Fix `sourcetext` for `SyntaxTree` with `LineNumberNode` provenance (#61267)

Commit
39 days ago
[JuliaSyntax] Fix `sourcetext` for `SyntaxTree` with `LineNumberNode` provenance (#61267) When a `SyntaxTree` node has `LineNumberNode` as its source provenance (which happens for nodes created via `expr_to_est` during old-style macro expansion), the generic `sourcetext(x)` would call `view(sourcefile(x), byte_range(x))` which fails with `MethodError` because `view(::LineNumberNode, ::UnitRange)` is not defined. Add a specialized `sourcetext(::SyntaxTree)` method that checks for `LineNumberNode` and returns `SubString("")`, consistent with the existing `sourcetext(::LineNumberNode)` method. Fixes aviatesk/JETLS.jl#583 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Author
Parents
Loading