Skip to content

Populate declaration-site locations on file-scope decl carriers - #100

Merged
trendvidia merged 1 commit into
trendvidiafrom
decl-locations
Jul 23, 2026
Merged

Populate declaration-site locations on file-scope decl carriers#100
trendvidia merged 1 commit into
trendvidiafrom
decl-locations

Conversation

@trendvidia

Copy link
Copy Markdown
Owner

Fixes #99.

The protowire.schema.v1 file-scope declaration carriers (FileAnnotationDecls 50401, FileFunctions 50402, FileTypeDecls 50403) all define a location field, but none of the three builders in fdp/annotations.go populated it — only annotation use sites did, via locationOf(u.AST().At()).

Each builder now sets Location from the declaration's name token (AST().Name()), matching the use-site convention of anchoring at the name. locationOf already returns nil for zero tokens, so synthesized decls with no source form are unaffected.

Consumers unblocked:

New TestAnnotationEmissionDeclLocations asserts file/line/column for all three carrier kinds. No golden churn — existing goldens don't serialize the decl carriers' location field.

The protowire.schema.v1 decl carriers (FileAnnotationDecls,
FileFunctions, FileTypeDecls) all carry a SourceLocation field, but
none of the three builders populated it — only annotation use sites
got locations. Anchor each declaration's location at its name token,
matching the use-site convention.

Fixes #99
@trendvidia trendvidia changed the title fdp: populate declaration-site locations on file-scope decl carriers Populate declaration-site locations on file-scope decl carriers Jul 23, 2026
@trendvidia
trendvidia merged commit ec4f20d into trendvidia Jul 23, 2026
1 of 2 checks passed
@trendvidia
trendvidia deleted the decl-locations branch July 23, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fdp: file-scope declaration carriers (50401-50403) omit declaration-site SourceLocation

1 participant