Describe the bug
W002 (unused parameter) is never reported for a function defined inside an unobserved: block or a match arm. check_unused_params recurses only through IF/FUNC/FOR/PROGRAM, and lists both AST_MATCH (src/lint.c:1530) and AST_UNOBSERVED (src/lint.c:1532) in its break-only group, so a nested define is never visited and the emission at src/lint.c:1475 is never reached.
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:
define w002_ctrl(unusedparam) as:
return 1
w002_ctrl of 9
Silent — inside unobserved::
unobserved:
define w002_u(unusedparam) as:
return 1
w002_u of 9
Silent — inside a match arm:
match 1:
case 1:
define w002_m(unusedparam) as:
return 1
case _:
x is 0
w002_m of 9
Expected behavior
warning[W002]: unused parameter 'unusedparam' in function '...' in all three, as the control already produces.
Actual behavior
$ eigenscript --lint w002_control.eigs
w002_control.eigs:1: warning[W002]: unused parameter 'unusedparam' in function 'w002_ctrl'
$ eigenscript --lint w002_unobs.eigs
w002_unobs.eigs: no issues found
$ eigenscript --lint w002_match.eigs
w002_match.eigs: no issues found
Both silent programs run (exit 0) and call the nested function, so these are reachable definitions.
Environment
- OS: Debian 13 (x86_64)
- GCC version: 14
- EigenScript version: 0.34.0 (
main @ 23edbc25)
Describe the bug
W002(unused parameter) is never reported for a function defined inside anunobserved:block or amatcharm.check_unused_paramsrecurses only through IF/FUNC/FOR/PROGRAM, and lists bothAST_MATCH(src/lint.c:1530) andAST_UNOBSERVED(src/lint.c:1532) in its break-only group, so a nesteddefineis never visited and the emission atsrc/lint.c:1475is never reached.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:
Silent — inside
unobserved::Silent — inside a
matcharm:Expected behavior
warning[W002]: unused parameter 'unusedparam' in function '...'in all three, as the control already produces.Actual behavior
Both silent programs run (exit 0) and call the nested function, so these are reachable definitions.
Environment
main@23edbc25)