Field-name spans: Expr::Field.name has no span #64
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found while implementing #55 (check .field access on structs).
`Expr::Field { base: BoxSpannedExpr, name: Ident<'src> }` in `twill-parser/src/ast.rs` — `Ident<'src>` is just `&'src str`, with no span attached. This carries through the lowering pass into the checker's HIR, where `name` becomes a bare `Symbol<'db>`, also spanless.
Effect: `check_field`'s `StructFieldNotDefined` diagnostic (and any future field-access diagnostic) can only point at `base`'s span (`foo` in `foo.bar`), not at the field name itself (`bar`) — even though the field name is the actual source of the error.
Fix would be parser-level: `Field { name: Ident<'src> }` needs to become something like `Field { name: Spanned<Ident<'src>> }` (or a small spanned-ident wrapper), threaded through lowering into HIR's `Symbol` too.