<< Back to previous view

[CLJS-606] Wrong line number reported when warning about undeclared Var Created: 05/Oct/13  Updated: 11/Oct/13  Resolved: 11/Oct/13

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Greg Wanish Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Windows 7 Home Premium 64 bit, Leiningen 2.1.2 on Java 1.7.0_05 Java HotSpot(TM) 64-Bit Server VM

Attachments: File hello.cljs     File project.clj    


While using cljsbuild v.3.2 or v.3.3, and cljs v1859, an undeclared
Var error will report the error at the wrong line number (i.e. 11
instead of 6):

(ns example.hello)

(defn foo [a b]
(* a b))

(fooo 2 3)

A cljsbuild "clean" executes normally, but an "auto" yields an error:

C:\Users\Greg\simple - test>lein cljsbuild auto
Compiling ClojureScript.
Compiling "resources/public/js/main.js" from ["src-cljs"]...
WARNING: Use of undeclared Var example.hello/fooo at line 11 src-cljs\example\hello.cljs
←[32mSuccessfully compiled "resources/public/js/main.js" in 15.988207202 seconds.←[0m

When I deliberately create other undeclared Var
errors further down in the file, the line number discrepancies become
even larger.

I changed ClojureScript dependencies to isolate the problem. The wrong
line number errors seem to begin with cljs v0.0-1853. v1847 seems to work correctly. Minimal reproducing case
follows in the attachments.

Comment by David Nolen [ 06/Oct/13 10:57 AM ]

Have tried testing this with a more recent release like 1913?

Comment by Greg Wanish [ 06/Oct/13 1:54 PM ]

I did try with 1913, same problem.

Comment by David Nolen [ 07/Oct/13 8:01 PM ]

If you have time to isolate the commit where things went wrong that would be extremely helpful. Thanks!

Comment by Greg Wanish [ 10/Oct/13 3:29 PM ]

The first commit, 9f010ff...:


coming after 1847 reports the wrong line number.

Comment by David Nolen [ 10/Oct/13 5:30 PM ]

I am able to recreate the issue with the provided file. However if I make a file from scratch I am unable to reproduce. Perhaps this is encoding problem and tools.reader is reporting the wrong line number as a result?

Comment by Greg Wanish [ 10/Oct/13 5:47 PM ]

This problem started while I was using Light Table. I read some time ago that LT uses Code Mirror as its editor. Do you know of any encoding issues with Code Mirror? What kind of encoding does tools.reader expect?

Comment by Greg Wanish [ 10/Oct/13 6:11 PM ]

I am able to reproduce this issue when I recreate the test file from scratch using Light Table and Notepad++.

Comment by Nicola Mometto [ 10/Oct/13 7:23 PM ]

Greg, there was an issue in the tools.reader version that clojurescript uses that caused wrong column info when reading \r\n, I've fixed it and released a new version.

Once it hits maven David will cut a new clojurescript release using the new tools.reader that will fix this issue.

Sorry for the inconvenience

Comment by David Nolen [ 11/Oct/13 7:29 AM ]

I've released ClojureScript 0.0-1933

Generated at Wed Jan 17 03:40:01 CST 2018 using JIRA 4.4#649-r158309.