Skip to content

Commit

Permalink
Fix crash when linting file that excludes 'list' from namespace with …
Browse files Browse the repository at this point in the history
…macro

Fixes: candid82#419
  • Loading branch information
jcburley committed Sep 10, 2020
1 parent 24fc702 commit 0b3c61c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ func parseList(obj Object, ctx *ParseContext) Expr {
symNs := ctx.GlobalEnv.NamespaceFor(ctx.GlobalEnv.CurrentNamespace(), sym)
if !ctx.isUnknownCallableScope {
if symNs == nil || symNs == ctx.GlobalEnv.CurrentNamespace() {
printParseError(obj.GetInfo().Pos(), "Unable to resolve symbol: "+sym.ToString(false))
printParseError(GetPosition(obj), "Unable to resolve symbol: "+sym.ToString(false))
}
}
vr = InternFakeSymbol(symNs, sym)
Expand Down Expand Up @@ -1805,7 +1805,7 @@ func parseSymbol(obj Object, ctx *ParseContext) Expr {
}
if !ctx.isUnknownCallableScope {
if ctx.linterBindings.GetBinding(sym) == nil {
printParseError(obj.GetInfo().Pos(), "Unable to resolve symbol: "+sym.ToString(false))
printParseError(GetPosition(obj), "Unable to resolve symbol: "+sym.ToString(false))
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions tests/linter/exclude-list/input.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ns foo
(:refer-clojure :exclude [list]))

(defmacro bar [baz]
`(identity ~baz))
1 change: 1 addition & 0 deletions tests/linter/exclude-list/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<file>:0:0: Parse error: Unable to resolve symbol: list

0 comments on commit 0b3c61c

Please sign in to comment.