Describe the bug
W013 (function definition shadows a builtin) is never reported inside an unobserved: block or a match arm. It shares a walker with W012 — check_builtin_shadow — which recurses only through IF/LOOP/FOR/FUNC/TRY/PROGRAM, so with AST_MATCH (src/lint.c:799) and AST_UNOBSERVED (src/lint.c:801) in the break-only group the nested define is never visited and the emission at src/lint.c:741 never fires.
Filed separately from W012 because the two are distinct diagnostics, but a single fix to that walker's recursion closes both.
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 range(a) as:
return a
Silent — inside unobserved::
unobserved:
define range(a) as:
return a
Silent — inside a match arm:
match 1:
case 1:
define range(a) as:
return a
case _:
x is 0
Expected behavior
warning[W013]: 'range' is a builtin — function definition shadows it in all three.
Actual behavior
$ eigenscript --lint w013_control.eigs
w013_control.eigs:1: warning[W013]: 'range' is a builtin — function definition shadows it
$ eigenscript --lint w013_unobs.eigs
w013_unobs.eigs: no issues found
$ eigenscript --lint w013_match.eigs
w013_match.eigs: no issues found
Environment
- OS: Debian 13 (x86_64)
- GCC version: 14
- EigenScript version: 0.34.0 (
main @ 23edbc25)
Describe the bug
W013(function definition shadows a builtin) is never reported inside anunobserved:block or amatcharm. It shares a walker with W012 —check_builtin_shadow— which recurses only through IF/LOOP/FOR/FUNC/TRY/PROGRAM, so withAST_MATCH(src/lint.c:799) andAST_UNOBSERVED(src/lint.c:801) in the break-only group the nesteddefineis never visited and the emission atsrc/lint.c:741never fires.Filed separately from W012 because the two are distinct diagnostics, but a single fix to that walker's recursion closes both.
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[W013]: 'range' is a builtin — function definition shadows itin all three.Actual behavior
Environment
main@23edbc25)