Compiler error message misses the target

110 views
Skip to first unread message

Alan Thompson

unread,
May 8, 2019, 12:21:36 AM5/8/19
to clojure
<rant-on-error-messages>

So I get a strange error from the compiler after a few minor edits:

Syntax error compiling at (tupelo/forest.clj:7:1).
Unable to resolve symbol: d in this context
Full report at: /tmp/clojure-18236661144073611223.edn

with the following EDN message:

{:clojure.main/message
 "Syntax error compiling at (tupelo/forest.clj:7:1).\nUnable to resolve symbol: d in this context\n",
 :clojure.main/triage
 {:clojure.error/phase :compile-syntax-check,
  :clojure.error/line 7,
  :clojure.error/column 1,
  :clojure.error/source "forest.clj",
  :clojure.error/path "tupelo/forest.clj",
  :clojure.error/class java.lang.RuntimeException,
  :clojure.error/cause "Unable to resolve symbol: d in this context"},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.Compiler$CompilerException,
    :message "Syntax error compiling at (tupelo/forest.clj:7:1).",
    :data
    {:clojure.error/phase :compile-syntax-check,
     :clojure.error/line 7,
     :clojure.error/column 1,
     :clojure.error/source "tupelo/forest.clj"},
    :at [clojure.lang.Compiler analyze "Compiler.java" 6808]}
   {:type java.lang.RuntimeException,
    :message "Unable to resolve symbol: d in this context",
    :at [clojure.lang.Util runtimeException "Util.java" 221]}],
.....

and I figure I accidentally got a typo somewhere.  Look at the top of the file:

Screenshot from 2019-05-07 21-08-39.png
Hmmm, no stray characters there...
 <Searches several files for many minutes, uses git, re-compile, head-scratching, finally looks at random near edit site...Ah ha!>
Oh, look at this on line 159:
Screenshot from 2019-05-07 21-12-11.png

So, I got a random character inserted, and the compiler directs me to a line 152 lines away from the actual error location.  Any we wonder why Clojure has slow adoption....

</rant-on-error-messages>

I could probably figure out a fix for problems like this, but I'm worried that it wouldn't be accepted.

Alan




Andy Fingerhut

unread,
May 8, 2019, 1:16:01 AM5/8/19
to clo...@googlegroups.com
You can check with Alex Miller if you have doubts, but given that error messages, and in particular the one you show, is at this moment an area of active changes in Clojure 1.10.1 beta versions, they may be open to fixes to such things right now.

Andy

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/CAN67zA1vrk_%2BTx0LcmznPNnZzW7GZFsOGaSn1AdWWJ1Fyc%2BZGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Matching Socks

unread,
May 8, 2019, 5:42:37 AM5/8/19
to Clojure
Was that letter d the only error in the file, as it turned out?

Alex Miller

unread,
May 8, 2019, 7:24:23 AM5/8/19
to Clojure
I would definitely be interested in understanding and improving that error reporting. What was the command you ran to produce the error and can you make a smaller self contained repro?

Peter Hull

unread,
May 8, 2019, 8:08:49 AM5/8/19
to Clojure
I tried just with the output of 'lein new app' - put an extra 'd' somewhere at the top level in core.clj, say below (defn- main ...), and then 'lein run' will give a strange location for the error (e.g. line 1 column 113)
Is the same as what Alan is reporting?
Reply all
Reply to author
Forward
0 new messages