Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by
retagged by

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.

2 Answers

0 votes
by

Which version of Clojure?

by
`Clojure CLI version 1.10.3.981` for the toy example, and Clojure 1.10.1 for the real example.
0 votes
by
...