don't warn for symbols hidden in macros

This commit is contained in:
XeroOl 2024-03-01 14:52:23 -06:00
parent 284983657f
commit 45ab692db4
2 changed files with 3 additions and 4 deletions

View File

@ -84,7 +84,7 @@ the `file.diagnostics` field, filling it with diagnostics."
:codeDescription "bad-unpack"})))
(λ var-never-set [self file symbol definition]
(if (and definition.var? (not definition.var-set))
(if (and definition.var? (not definition.var-set) (. file.lexical symbol))
{:range (message.ast->range self file symbol)
:message (.. "var is never set: " (tostring symbol) " Consider using (local) instead of (var)")
:severity message.severity.WARN

View File

@ -168,9 +168,8 @@
(check "(var x 1) (set x 2) (print x)"
[] [{}])
;; TODO fix diagnostic
; (check "(local x 10) (?. x)"
; [] [{:code 305}])
(check "(local x 10) (?. x)"
[] [{:code 305}])
nil)
;; missing test for 306