Fix unknown field false positive
When attempting to search through a require, analyzer.search-list was returning nil instead of indeterminate if it could not find the file. Fixes #89
This commit is contained in:
parent
b08743f79e
commit
515e40bd4c
@ -139,15 +139,16 @@ find the definition `10`, but if `opts.stop-early?` is set, it would find
|
|||||||
(search-multival server file (. call (+ len 1)) stack (+ multival (- len) 1) opts)))
|
(search-multival server file (. call (+ len 1)) stack (+ multival (- len) 1) opts)))
|
||||||
(where (or :require :include))
|
(where (or :require :include))
|
||||||
(let [mod (. call 2)]
|
(let [mod (. call 2)]
|
||||||
(if (= multival 1)
|
(when (and (= multival 1) (= :string (type mod)))
|
||||||
(when (= :string (type mod))
|
(when (= (length stack) 1)
|
||||||
(let [newfile (files.get-by-module server mod file.macro-file?)]
|
(set opts.searched-through-require-with-stack-size-1 true))
|
||||||
(when newfile
|
(case (files.get-by-module server mod file.macro-file?)
|
||||||
(compiler.compile server newfile)
|
newfile (do
|
||||||
(let [newitem (. newfile.ast (length newfile.ast))]
|
(compiler.compile server newfile)
|
||||||
(when (= (length stack) 1)
|
(let [newitem (. newfile.ast (length newfile.ast))]
|
||||||
(set opts.searched-through-require-with-stack-size-1 true))
|
(search-val server newfile newitem stack opts)))
|
||||||
(search-val server newfile newitem stack opts)))))))
|
_ (if opts.searched-through-require-with-stack-size-1
|
||||||
|
{:indeterminate true}))))
|
||||||
"."
|
"."
|
||||||
(if (= multival 1)
|
(if (= multival 1)
|
||||||
(let [[_ & rest] call]
|
(let [[_ & rest] call]
|
||||||
|
|||||||
@ -435,6 +435,15 @@
|
|||||||
(where (or a [a])) (print (+ a 3))
|
(where (or a [a])) (print (+ a 3))
|
||||||
(catch (x) x))))
|
(catch (x) x))))
|
||||||
|
|
||||||
|
(fn test-re-export-module []
|
||||||
|
(check {:utils.fnl
|
||||||
|
"{:mod (require :module)}"
|
||||||
|
:main.fnl
|
||||||
|
"(local {: mod} (require :utils))"}
|
||||||
|
[]
|
||||||
|
[{:code :unknown-module-field :message "unknown field: mod"}])
|
||||||
|
nil)
|
||||||
|
|
||||||
{: test-unused
|
{: test-unused
|
||||||
: test-ampersand
|
: test-ampersand
|
||||||
: test-unknown-module-field
|
: test-unknown-module-field
|
||||||
@ -454,4 +463,5 @@
|
|||||||
: test-duplicate-keys
|
: test-duplicate-keys
|
||||||
: test-nested-associative-operator
|
: test-nested-associative-operator
|
||||||
: test-zero-indexed
|
: test-zero-indexed
|
||||||
: test-legacy-multival}
|
: test-legacy-multival
|
||||||
|
: test-re-export-module}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user