2024 年 Clojure 调查问卷 中分享您的想法!

欢迎!有关如何使用本网站的更多信息,请参阅 关于 页面。

0
tools.emitter.jvm

user> (loop [acc 0
             col (range 50)]
        (if-not (empty? col)
          (recur (+ acc (first col)) (rest col))
          acc))


生成异常


期望: (= (apply + (range 50)) (e/eval (quote (loop [acc 0 col (range 50)] (if-not (empty? col) (recur (+ acc (first col)) (rest col)) acc)))))
  实际: java.lang.VerifyError: Bad type on operand stack
异常详情
  位置
    clojure/tools/emitter/passes/jvm/annotate_internal_name$fn__8917.invoke()Ljava/lang/Object; @4: invokestatic
  原因
    类型 'java/lang/Number' (当前帧,栈[0]) 无法赋值给 long_2nd
  当前帧
    bci: @4
    flags: { }
    locals: { 'clojure/tools/emitter/passes/jvm/annotate_internal_name$fn__8917' }
    stack: { 'java/lang/Number' }
  字节码
    0x0000000: 2ab6 0045 b800 49b0

 at java.lang.Class.getDeclaredConstructors0 (Class.java:-2)
    java.lang.Class.privateGetDeclaredConstructors (Class.java:2671)
    java.lang.Class.getConstructor0 (Class.java:3075)
    java.lang.Class.newInstance (Class.java:412)
    clojure.tools.emitter.jvm$eval.invoke (clojure/tools/emitter/jvm.clj:105)
    clojure.tools.emitter.jvm$eval.invoke (clojure/tools/emitter/jvm.clj:83)
    clojure.tools.emitter.jvm.core_test$fn__8193$fn__8328.invoke (core_test.clj:74)
    clojure.tools.emitter.jvm.core_test/fn (core_test.clj:73)

2 答案

0

评论由:bronsa

看起来是一个装箱问题,不确定我什么时候有时间来调查/修复这个问题

0
参考: https://clojure.atlassian.net/browse/TEMJVM-11(由 arrdem 报告)
...