5
1
Fork
You've already forked spindle-rust
2

fix(parser): derive claims child error lines from source offsets #6

Merged
hugooconnor merged 1 commit from davidfactor/spindle-rust:codex/pr-parser-claims-line-offset into main 2026年02月08日 09:02:05 +01:00

Summary

This fixes incorrect line numbers for errors inside claims blocks, especially when inner expressions are on the same line.

Problem

claims child expressions were assigned line numbers using line + expr_idx + 1, which is heuristic and can produce impossible diagnostics (for example, reporting line 3 for a one-line input).

Changes

  • Added source-offset tracking to parsed SExpr nodes.
  • Updated SPL parsing internals to preserve offsets while parsing atoms/lists/strings.
  • Updated claims processing to compute each child expression line via line_of_offset(cleaned_input, expr.offset()).
  • Kept existing behavior otherwise unchanged.

Regression test added

  • test_claims_inner_expression_single_line_reports_line_one
  • Verifies malformed inner claims expression on a single line reports line 1 correctly.

Validation

  • cargo test -p spindle-parser --lib
## Summary This fixes incorrect line numbers for errors inside `claims` blocks, especially when inner expressions are on the same line. ## Problem `claims` child expressions were assigned line numbers using `line + expr_idx + 1`, which is heuristic and can produce impossible diagnostics (for example, reporting `line 3` for a one-line input). ## Changes - Added source-offset tracking to parsed `SExpr` nodes. - Updated SPL parsing internals to preserve offsets while parsing atoms/lists/strings. - Updated `claims` processing to compute each child expression line via `line_of_offset(cleaned_input, expr.offset())`. - Kept existing behavior otherwise unchanged. ## Regression test added - `test_claims_inner_expression_single_line_reports_line_one` - Verifies malformed inner `claims` expression on a single line reports `line 1` correctly. ## Validation - `cargo test -p spindle-parser --lib`
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
anuna/spindle-rust!6
Reference in a new issue
anuna/spindle-rust
No description provided.
Delete branch "davidfactor/spindle-rust:codex/pr-parser-claims-line-offset"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?