Given a form with am invalid trailing character (I think I hit an incorrect key combination when changing window), the Clojure compiler emits an error with the wrong line number.
Given a file foo.clj
like this:
(defn foo [x]
(print "hello world")
(+ x x))π
We get an error message referencing line 0 column 0:
$ clj --init foo.clj
Syntax error compiling at (foo.clj:0:0).
Unable to resolve symbol: π in this context
In a real example, I had a stray π
character at the top level, on line 142 of a file, between two defn
forms. The error message was:
Exception: clojure.lang.Compiler$CompilerException: Syntax error compiling at (circle/model/test_build.clj:1:112).
#:clojure.error{:phase :compile-syntax-check, :line 1, :column 112, :source "circle/model/test_build.clj"}
at clojure.lang.Compiler.analyze (Compiler.java:6808)
The defn
form before the stray character started at line 112, I'm not sure why column
is 112, and not line
though.