Describe the bug
W001 (unused variable) is never reported for an assignment that exists only inside a match arm. collect_assigns recurses into AST_BLOCK and AST_UNOBSERVED (src/lint.c:344-348) but lists AST_MATCH in its break-only group (src/lint.c:385), so the name is never recorded and the emission loop at src/lint.c:3061-3077 never sees it.
Unlike the sibling gaps, this one is match-only — unobserved: bodies are walked and do report correctly.
Surfaced while doing #779, which made these switches enumerable; it neither caused nor fixed this. Line numbers resolved against main @ 23edbc25.
To reproduce
Control — reported correctly:
Also reported correctly (unobserved: is walked):
unobserved:
w001_inunobs is 5
Silent — the bug:
match 1:
case 1:
w001_inmatch is 5
case _:
w001_inmatch2 is 6
Expected behavior
warning[W001]: unused variable 'w001_inmatch' (and 'w001_inmatch2'), as the top-level and unobserved: cases already produce.
Actual behavior
$ eigenscript --lint w001_control.eigs
w001_control.eigs:1: warning[W001]: unused variable 'w001_top'
$ eigenscript --lint w001_unobs.eigs
w001_unobs.eigs:2: warning[W001]: unused variable 'w001_inunobs'
$ eigenscript --lint w001_match.eigs
w001_match.eigs: no issues found
The program runs (exit 0), so this is live code the linter is silent on, not a parse artifact.
Environment
- OS: Debian 13 (x86_64)
- GCC version: 14
- EigenScript version: 0.34.0 (
main @ 23edbc25)
Describe the bug
W001(unused variable) is never reported for an assignment that exists only inside amatcharm.collect_assignsrecurses intoAST_BLOCKandAST_UNOBSERVED(src/lint.c:344-348) but listsAST_MATCHin its break-only group (src/lint.c:385), so the name is never recorded and the emission loop atsrc/lint.c:3061-3077never sees it.Unlike the sibling gaps, this one is
match-only —unobserved:bodies are walked and do report correctly.Surfaced while doing #779, which made these switches enumerable; it neither caused nor fixed this. Line numbers resolved against
main@23edbc25.To reproduce
Control — reported correctly:
Also reported correctly (
unobserved:is walked):Silent — the bug:
Expected behavior
warning[W001]: unused variable 'w001_inmatch'(and'w001_inmatch2'), as the top-level andunobserved:cases already produce.Actual behavior
The program runs (exit 0), so this is live code the linter is silent on, not a parse artifact.
Environment
main@23edbc25)