Repository navigation
Conversation
tree-sitter-go nests the specs of a parenthesized `var ( ... )` under a var_spec_list node, but extract_vars_mainstream only inspected direct var_spec/const_spec children, so grouped package-level vars produced no Variable definition. Single `var x` and `const ( ... )` (whose const_spec children are direct; the grammar has no const_spec_list) already worked. Move the Go case into extract_go_vars/extract_go_spec, which also walk the children of a var_spec_list. Multi-name specs (`var a, b = 1, 2`) still record only the first name; that is a separate limitation left unchanged. Add go_grouped_var_specs_mint_variables covering a var group, a const group and a single var, asserting names, label and line ranges. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Tony Thayer-Osborne <962968+tthayer@users.noreply.github.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
Thank you for separating this extraction fix from the Wire feature and for documenting the final helper rewrite and its rerun coverage. I checked the Go variable loop on current main: it handles direct var_spec/const_spec children. This is a focused bug-fix candidate independent of approving BINDS. The review queue is currently full, so a complete review may take a little time. Thank you for your patience and for helping improve the project; this acknowledgement is not yet an approval or a merge commitment. |
Problem
A parenthesized Go
varblock produces noVariablenodes:tree-sitter-go nests these specs under a
var_spec_listnode.extract_vars_mainstream(internal/cbm/extract_defs.c, Go case) only reads directvar_spec/const_specchildren, so it never sees them. Singlevar x = 1works.const ( ... )also works, because itsconst_specchildren are direct (the grammar has noconst_spec_list).Anything keyed on package-level variables misses grouped declarations. Found while measuring #2452:
wire.NewSet(...)provider sets declared inside avar ( ... )block had noVariablesource node.Change
The Go case moves into two helpers,
extract_go_varsandextract_go_spec, which read direct specs and also the children of eachvar_spec_list. The loops are flat because clang-tidy'smisc-no-recursionrejects the recursive form. No other language is touched.Test
go_grouped_var_specs_mint_variablesintests/test_extraction.ccovers avargroup, aconstgroup and a singlevar. It asserts the names, theVariablelabel, the line ranges, and exactly 5 Variables.d is NULL);extractionis 393 passed, 1 failed.extraction394 passed.--suites): 8305 passed, 0 failed, 10 skipped. No ledger or contract constants moved. That run used an earlier recursive version of the helper, rewritten flat for clang-tidy; after the rewrite,extraction,lang_contractandedge_structuralwere re-run: 469 passed.lint-tidy-diffandlint-memory-core.py: clean.Not changed
Multi-name specs (
var a, b = 1, 2) still record only the first name, because the code reads the singlenamefield. That has a different cause.Written with Claude Code (Anthropic). I reviewed the change and am accountable for it.