Clojure

Undefined symbols raise exceptions with line/column number of enclosing expression

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: Release 1.5
  • Fix Version/s: Release 1.6
  • Component/s: None
  • Labels:
  • Patch:
    Code
  • Approval:
    Screened

Description

Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but an incorrect line:column number. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 0:0, or line:column number of REPL input, if loaded from a REPL. The behavior is different in a Leiningen REPL. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.

$ cat test1.clj 

bla
$ cat test2.clj 

(bla)
$ java -cp ../../opt/clojure/clojure-1.5.1.jar:. clojure.main
Clojure 1.5.1
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:1:1) 
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:2:1) 
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1) 
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1) 
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:5:1)

Patch: CLJ-420-3.patch

Approach: Capture line and column metadata for symbols in the LispReader. A few tests were adjusted to ignore line and col metadata for protocol symbols which now have them.

Screened by: Alex Miller

Background: Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2: http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

  1. CLJ-420.patch
    19/Oct/13 9:31 PM
    3 kB
    Paavo Parkkinen
  2. CLJ-420-2.patch
    20/Oct/13 5:05 PM
    3 kB
    Alex Miller
  3. CLJ-420-3.patch
    21/Oct/13 8:29 AM
    3 kB
    Alex Miller
  4. CLJ-420-4.patch
    28/Oct/13 7:44 AM
    3 kB
    Paavo Parkkinen

Activity

Alexander Redington made changes -
Field Original Value New Value
Reporter Alexander Redington [ aredington ]
Priority Blocker [ 1 ]
Approval Vetted
Aaron Bedra made changes -
Fix Version/s Approved Backlog [ 10034 ]
Fix Version/s Release.Next [ 10038 ]
Affects Version/s Approved Backlog [ 10034 ]
Priority Blocker [ 1 ] Major [ 3 ]
Rich Hickey made changes -
Fix Version/s Approved Backlog [ 10034 ]
Fix Version/s Release 1.6 [ 10157 ]
Alex Miller made changes -
Affects Version/s Approved Backlog [ 10034 ]
Affects Version/s Backlog [ 10035 ]
Andy Fingerhut made changes -
Description Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but what seems to be the REPL line number.

http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

jawolfe@[~/Projects/testproj]: cat > src/test.clj

bla
jawolfe@[~/Projects/testproj]: cat > src/test2.clj

(bla)
jawolfe@[~/Projects/testproj]: lein repl
user=> (require 'test)
java.lang.Exception: Unable to resolve symbol: bla in this context
(test.clj:1)
user=> (require 'test)a
java.lang.Exception: Unable to resolve symbol: bla in this context
(test.clj:2)
user=> (require 'test)
java.lang.Exception: Unable to resolve symbol: bla in this context
(test.clj:3)
user=> (require 'test2)
java.lang.Exception: Unable to resolve symbol: bla in this context
(test2.clj:2)
user=> (require 'test2)
java.lang.Exception: Unable to resolve symbol: bla in this context
(test2.clj:2)
user=> (require 'test2)
java.lang.Exception: Unable to resolve symbol: bla in this context
(test2.clj:2)
user=> (require 'test)
java.lang.Exception: Unable to resolve symbol: bla in this context
(test.clj:7)
user=>
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but seem to always be line number 1. This seems to happen when unknown symbols occur by themselves, not called as a function.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2. The behavior was different then:
http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

{noformat}
% cat > src/test.clj

bla
% cat > src/test2.clj

(bla)
% lein repl
user=> (require 'test) ; Correct line number for error is 2, not 1
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test2) ; This exception gives correct line number 2
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=>
{noformat}
Affects Version/s Backlog [ 10035 ]
Affects Version/s Release 1.5 [ 10150 ]
Summary Some compiler exceptions erroneously using REPL line numbers. Some compiler exceptions erroneously using line number 1
Andy Fingerhut made changes -
Description Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but seem to always be line number 1. This seems to happen when unknown symbols occur by themselves, not called as a function.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2. The behavior was different then:
http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

{noformat}
% cat > src/test.clj

bla
% cat > src/test2.clj

(bla)
% lein repl
user=> (require 'test) ; Correct line number for error is 2, not 1
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test2) ; This exception gives correct line number 2
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=>
{noformat}
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but seem to always be line number 1. This seems to happen when unknown symbols occur by themselves, not called as a function.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2. The behavior was different then:
http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:

{noformat}
% cat > src/test.clj

bla
% cat > src/test2.clj

(bla)
% lein repl
user=> (require 'test) ; Correct line number for error is 2, not 1
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test2) ; This exception gives correct line number 2
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=>
{noformat}
Andy Fingerhut made changes -
Description Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but seem to always be line number 1. This seems to happen when unknown symbols occur by themselves, not called as a function.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2. The behavior was different then:
http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:

{noformat}
% cat > src/test.clj

bla
% cat > src/test2.clj

(bla)
% lein repl
user=> (require 'test) ; Correct line number for error is 2, not 1
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test2) ; This exception gives correct line number 2
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=>
{noformat}
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but seem to always be line number 1. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line number 1.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2. The behavior was different then:
http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:

{noformat}
% cat > src/test.clj

bla
% cat > src/test2.clj

(bla)
% lein repl
user=> (require 'test) ; Correct line number for error is 2, not 1
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test2) ; This exception gives correct line number 2
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=>
{noformat}
Andy Fingerhut made changes -
Description Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but seem to always be line number 1. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line number 1.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2. The behavior was different then:
http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:

{noformat}
% cat > src/test.clj

bla
% cat > src/test2.clj

(bla)
% lein repl
user=> (require 'test) ; Correct line number for error is 2, not 1
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test2) ; This exception gives correct line number 2
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=>
{noformat}
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but seem to always be line number 1. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2. The behavior was different then:
http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:

{noformat}
% cat > src/test.clj

bla
% cat > src/test2.clj

(bla)
% lein repl
user=> (require 'test) ; Correct line number for error is 2, not 1
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test2) ; This exception gives correct line number 2
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=>
{noformat}
Summary Some compiler exceptions erroneously using line number 1 Undefined symbols raise exceptions with line/column number of enclosing expression
Alex Miller made changes -
Approval Vetted [ 10003 ] Triaged [ 10120 ]
Priority Major [ 3 ] Minor [ 4 ]
Fix Version/s Release 1.6 [ 10157 ]
Rich Hickey made changes -
Approval Triaged [ 10120 ] Vetted [ 10003 ]
Fix Version/s Release 1.6 [ 10157 ]
Paavo Parkkinen made changes -
Description Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but seem to always be line number 1. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2. The behavior was different then:
http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:

{noformat}
% cat > src/test.clj

bla
% cat > src/test2.clj

(bla)
% lein repl
user=> (require 'test) ; Correct line number for error is 2, not 1
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=> (require 'test2) ; This exception gives correct line number 2
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test.clj:1:1)
user=>
{noformat}
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but an incorrect line:column number. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 0:0, or line:column number of REPL input, if loaded from a REPL.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2: http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:
{noformat}
$ cat test1.clj

bla
$ cat test2.clj

(bla)
$ java -cp ../../opt/clojure/clojure-1.5.1.jar:. clojure.main
Clojure 1.5.1
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:1:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:5:1)
{noformat}

The behavior is different in a Leiningen REPL. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.
Paavo Parkkinen made changes -
Attachment CLJ-420.patch [ 12296 ]
Alex Miller made changes -
Approval Vetted [ 10003 ] Incomplete [ 10006 ]
Description Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but an incorrect line:column number. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 0:0, or line:column number of REPL input, if loaded from a REPL.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2: http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:
{noformat}
$ cat test1.clj

bla
$ cat test2.clj

(bla)
$ java -cp ../../opt/clojure/clojure-1.5.1.jar:. clojure.main
Clojure 1.5.1
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:1:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:5:1)
{noformat}

The behavior is different in a Leiningen REPL. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but an incorrect line:column number. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 0:0, or line:column number of REPL input, if loaded from a REPL.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2: http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:
{noformat}
$ cat test1.clj

bla
$ cat test2.clj

(bla)
$ java -cp ../../opt/clojure/clojure-1.5.1.jar:. clojure.main
Clojure 1.5.1
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:1:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:5:1)
{noformat}

The behavior is different in a Leiningen REPL. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.

*Patch:* CLJ-420.patch

*Approach:*
Paavo Parkkinen made changes -
Attachment CLJ-420.patch [ 12344 ]
Alex Miller made changes -
Attachment CLJ-420.patch [ 12296 ]
Alex Miller made changes -
Patch Code [ 10001 ]
Approval Incomplete [ 10006 ] Screened [ 10004 ]
Description Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but an incorrect line:column number. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 0:0, or line:column number of REPL input, if loaded from a REPL.

Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2: http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc

Updated demonstration of issue when tried with Clojure 1.5.1:
{noformat}
$ cat test1.clj

bla
$ cat test2.clj

(bla)
$ java -cp ../../opt/clojure/clojure-1.5.1.jar:. clojure.main
Clojure 1.5.1
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:1:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:5:1)
{noformat}

The behavior is different in a Leiningen REPL. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.

*Patch:* CLJ-420.patch

*Approach:*
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but an incorrect line:column number. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 0:0, or line:column number of REPL input, if loaded from a REPL. The behavior is different in a Leiningen REPL. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.

{code}
$ cat test1.clj

bla
$ cat test2.clj

(bla)
$ java -cp ../../opt/clojure/clojure-1.5.1.jar:. clojure.main
Clojure 1.5.1
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:1:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:5:1)
{code}

*Patch:* CLJ-420-2.patch

*Approach:* Capture line and column metadata for symbols in the LispReader. A few tests were adjusted to ignore line and col metadata for protocol symbols which now have them.

*Screened by:* Alex Miller

*Background:* Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2: http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc
Attachment CLJ-420-2.patch [ 12345 ]
Labels errormsgs reader
Alex Miller made changes -
Attachment CLJ-420-3.patch [ 12347 ]
Alex Miller made changes -
Description Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but an incorrect line:column number. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 0:0, or line:column number of REPL input, if loaded from a REPL. The behavior is different in a Leiningen REPL. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.

{code}
$ cat test1.clj

bla
$ cat test2.clj

(bla)
$ java -cp ../../opt/clojure/clojure-1.5.1.jar:. clojure.main
Clojure 1.5.1
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:1:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:5:1)
{code}

*Patch:* CLJ-420-2.patch

*Approach:* Capture line and column metadata for symbols in the LispReader. A few tests were adjusted to ignore line and col metadata for protocol symbols which now have them.

*Screened by:* Alex Miller

*Background:* Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2: http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but an incorrect line:column number. This seems to happen when unknown symbols occur by themselves, not called as a function.

The general pattern appears to be that an undefined symbol is reported with a line number of the beginning of its nearest enclosing expression. If the undefined symbol appears at the top level of a file, it is reported with line:column number 0:0, or line:column number of REPL input, if loaded from a REPL. The behavior is different in a Leiningen REPL. If the undefined symbol appears at the top level of a file, it is reported with line:column number 1:1.

{code}
$ cat test1.clj

bla
$ cat test2.clj

(bla)
$ java -cp ../../opt/clojure/clojure-1.5.1.jar:. clojure.main
Clojure 1.5.1
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:1:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test2.clj:2:1)
user=> (require 'test1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: bla in this context, compiling:(test1.clj:5:1)
{code}

*Patch:* CLJ-420-3.patch

*Approach:* Capture line and column metadata for symbols in the LispReader. A few tests were adjusted to ignore line and col metadata for protocol symbols which now have them.

*Screened by:* Alex Miller

*Background:* Clojure Google group thread when this issue was originally reported in 2010 against Clojure 1.2: http://groups.google.com/group/clojure/browse_frm/thread/beb36e7228eabd69/a7ef16dcc45834bc?hl=en#a7ef16dcc45834bc
Rich Hickey made changes -
Resolution Declined [ 2 ]
Status Open [ 1 ] Resolved [ 5 ]
Paavo Parkkinen made changes -
Attachment CLJ-420-4.patch [ 12411 ]

People

Vote (0)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: