Describe the bug
W012 (assignment shadows a builtin) is never reported inside an unobserved: block or a match arm. check_builtin_shadow recurses only through IF/LOOP/FOR/FUNC/TRY/PROGRAM, and both AST_MATCH (src/lint.c:799) and AST_UNOBSERVED (src/lint.c:801) sit in its break-only group, so the assignment is never inspected and the emission at src/lint.c:737 never fires.
Note this is the same walker as W013, so the two share a root cause even though the symptoms differ.
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:
range is 5
print of range
Silent — inside unobserved::
unobserved:
range is 5
print of 1
Silent — inside a match arm:
match 1:
case 1:
range is 5
case _:
x is 0
print of 1
Expected behavior
warning[W012]: 'range' is a builtin — assignment shadows it in all three.
Actual behavior
$ eigenscript --lint w012_control.eigs
w012_control.eigs:1: warning[W012]: 'range' is a builtin — assignment shadows it
$ eigenscript --lint w012_unobs.eigs
w012_unobs.eigs: no issues found
$ eigenscript --lint w012_match.eigs
w012_match.eigs: no issues found
Environment
- OS: Debian 13 (x86_64)
- GCC version: 14
- EigenScript version: 0.34.0 (
main @ 23edbc25)
Describe the bug
W012(assignment shadows a builtin) is never reported inside anunobserved:block or amatcharm.check_builtin_shadowrecurses only through IF/LOOP/FOR/FUNC/TRY/PROGRAM, and bothAST_MATCH(src/lint.c:799) andAST_UNOBSERVED(src/lint.c:801) sit in its break-only group, so the assignment is never inspected and the emission atsrc/lint.c:737never fires.Note this is the same walker as W013, so the two share a root cause even though the symptoms differ.
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[W012]: 'range' is a builtin — assignment shadows itin all three.Actual behavior
Environment
main@23edbc25)