Ensure that defining a function on an arg counts as a reference.

Otherwise you get a warning here saying that t is unused:

    (fn f [t x] (fn t.f []) x)
This commit is contained in:
Phil Hagelberg 2023-11-26 11:16:03 -08:00 committed by XeroOl
parent 765b3d784f
commit 5acaac966e
2 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ later by fennel-ls.language to answer requests from the client."
(table.insert target.referenced-by ast)))))
(λ symbol-to-expression [ast scope ?reference?]
(if ?reference?
(when (or ?reference? (fennel.multi-sym? ast))
(reference ast scope)))
(λ define [?definition binding scope]

View File

@ -97,7 +97,7 @@
(it "does not warn if a field is used"
(let [self (create-client)
responses (self:open-file! filename "(fn [abc] (set abc.xyz 10))")]
responses (self:open-file! filename "(fn [a b] (set a.x 10) (fn b.f []))")]
(assert (not (?. responses 1 :params :diagnostics 1)))))
(it "warns when using the : special when a multisym would do"