From 45ab692db4109032c583b719e07fc6bdbcd746bd Mon Sep 17 00:00:00 2001 From: XeroOl Date: Fri, 1 Mar 2024 14:52:23 -0600 Subject: [PATCH] don't warn for symbols hidden in macros --- src/fennel-ls/diagnostics.fnl | 2 +- test/diagnostic.fnl | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/fennel-ls/diagnostics.fnl b/src/fennel-ls/diagnostics.fnl index 789aac2..7f4cf0d 100644 --- a/src/fennel-ls/diagnostics.fnl +++ b/src/fennel-ls/diagnostics.fnl @@ -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 diff --git a/test/diagnostic.fnl b/test/diagnostic.fnl index 5c8c5c7..534e942 100644 --- a/test/diagnostic.fnl +++ b/test/diagnostic.fnl @@ -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