We're updating the issue view to help you get more done. 

Compilation errors on anonymous recursive function

Description

Seems the below does not compile with 1.8:

1 2 3 4 5 6 7 8 9 10 (def lazy-fib "Lazy sequence of fibonacci numbers" ((fn rfib [a b] (lazy-seq (cons a (rfib b (+' a b))))) 0 1)) (defn even-lazy-fib[n] (filter even? (take n lazy-fib))) (even-lazy-fib 10)

Status:

  • 1.7.0 - works

  • 1.8.0-alpha2 - works

  • 1.8.0-alpha3-1.8.0-beta1 - VerifyError, see below

  • 1.8.0-beta2 - NPE, see below

  • 1.8.0-RC1 - ClassCastException, see below

  • 1.8.0 master - NPE, see below

1.8.0-alpha3:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 CompilerException java.lang.VerifyError: (class: vecperf/bench$rfib__1233, method: invokeStatic signature: (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Illegal local variable number, compiling:(form-init3780016918836504993.clj:3:3) clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3661) clojure.lang.Compiler$DefExpr.eval (Compiler.java:455) clojure.lang.Compiler.eval (Compiler.java:6948) clojure.lang.Compiler.eval (Compiler.java:6906) clojure.core/eval (core.clj:3084) clojure.core/eval (core.clj:-1) clojure.main/repl/read-eval-print--7081/fn--7084 (main.clj:240) clojure.main/repl/read-eval-print--7081 (main.clj:240) clojure.main/repl/fn--7090 (main.clj:258) clojure.main/repl (main.clj:258) clojure.main/repl (main.clj:-1) clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn--630 (interruptible_eval.clj:58) Caused by: VerifyError (class: vecperf/bench$rfib__1233, method: invokeStatic signature: (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Illegal local variable number java.lang.Class.getDeclaredConstructors0 (Class.java:-2) java.lang.Class.privateGetDeclaredConstructors (Class.java:2658) java.lang.Class.getConstructor0 (Class.java:2964) java.lang.Class.newInstance (Class.java:403) clojure.lang.Compiler$ObjExpr.eval (Compiler.java:4943) clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3652) clojure.lang.Compiler$DefExpr.eval (Compiler.java:455)

1.8.0-beta2 / 1.8.0 master:

1 2 3 4 NullPointerException clojure.lang.Numbers.ops (Numbers.java:1013) clojure.lang.Numbers.addP (Numbers.java:132) user/rfib--1250/fn--1251 (form-init4987495233354047014.clj:4)

1.8.0-RC1:

1 2 ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn user/rfib--1250/fn--1251 (form-init1118919529313120594.clj:4)

Environment

OS X, Yosemite, jdk 1.8.0_60

Status

Assignee

Unassigned

Reporter

import

Labels

None

Approval

Vetted

Patch

None

Fix versions

Affects versions

Release 1.8

Priority

Major