2024年Clojure状态调查!中分享您的想法。

欢迎!请查阅关于页面以了解更多有关如何使用该网站的信息。

0
core.typed

添加以下注释会导致运行时异常

`
(t/ann ^:no-check clojure.core/hash-map

 [t/Any * -> (t/Map t/Any t/Any)])

`

异常

`
$ lein typed check
从central获取org/clojure/core.typed/0.3.3/core.typed-0.3.3.pom
从central获取org/clojure/core.typed-pom/0.3.3/core.typed-pom-0.3.3.pom
从central获取org/clojure/core.typed.rt/0.3.3/core.typed.rt-0.3.3.pom
从central获取org/clojure/clojure/1.7.0-RC2/clojure-1.7.0-RC2.pom
从central获取org/clojure/core.typed.rt/0.3.3/core.typed.rt-0.3.3.jar
从central获取org/clojure/core.typed/0.3.3/core.typed-0.3.3.jar
初始化core.typed...
构建core.typed基本环境...
在“main”线程中的异常:java.lang.AssertionError:断言失败:(every? r/Bounds? bbnds),编译:(/private/var/folders/fg/8xpsfgln1_s0cwh3f1ksxtjr0000gq/T/form-init6446670678682645381.clj:1:124)

at clojure.lang.Compiler.load(Compiler.java:7142)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$init_opt.invoke(main.clj:279)
at clojure.main$initialize.invoke(main.clj:307)
at clojure.main$null_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:420)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)

由:java.lang.AssertionError:断言失败:(every? r/Bounds? bbnds)

at clojure.core.typed.type_ctors$TypeFn_STAR_.invoke(type_ctors.clj:1040)
at clojure.core.typed.type_ctors$TypeFn_STAR_.invoke(type_ctors.clj:1041)
at clojure.core.typed.base_env_helper$declared_kind_for_rclass.invoke(base_env_helper.clj:179)
at clojure.core.typed.base_env_clj_rclass$generator_init_altered_env$fn__20119$fn__20125$iter__20126__20130$fn__20131.invoke(base_env_clj_rclass.clj:27)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:484)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$dorun.invoke(core.clj:2855)
at clojure.core$doall.invoke(core.clj:2871)
at clojure.core.typed.base_env_clj_rclass$generator_init_altered_env$fn__20119$fn__20125.invoke(base_env_clj_rclass.clj:27)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.core.typed.base_env_clj_rclass$generator_init_altered_env$fn__20119.invoke(base_env_clj_rclass.clj:27)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.core.typed.base_env_clj_rclass$generator_init_altered_env.invoke(base_env_clj_rclass.clj:25)
at clojure.core.typed.base_env_clj_rclass$init_altered_env.invoke(base_env_clj_rclass.clj:25)
at clojure.core.typed.base_env_clj_rclass$reset_rclass_env_BANG_.invoke(base_env_clj_rclass.clj:476)
at clojure.core.typed.base_env$generator_init_alias_env$fn__20466.invoke(base_env.clj:64)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.core.typed.base_env$generator_init_alias_env.invoke(base_env.clj:64)
at clojure.core.typed.base_env$init_alias_env.invoke(base_env.clj:64)
at clojure.core.typed.base_env$reset_alias_env_BANG_.invoke(base_env.clj:67)
at clojure.core.typed.base_env$reset_clojure_envs_BANG_$fn__20869$fn__20870.invoke(base_env.clj:1871)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.core.typed.base_env$reset_clojure_envs_BANG_$fn__20869.invoke(base_env.clj:1870)
at clojure.core.typed.base_env$reset_clojure_envs_BANG_.invoke(base_env.clj:1870)
at clojure.core.typed.reset_env$reset_envs_BANG_.invoke(reset_env.clj:20)
at clojure.core.typed.init$load_impl$fn__1728$fn__1729.invoke(init.clj:113)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.core.typed.init$load_impl$fn__1728.invoke(init.clj:112)
at clojure.core.typed.init$load_impl.invoke(init.clj:112)
at clojure.core.typed.load_if_needed$load_if_needed.invoke(load_if_needed.clj:22)
at clojure.core.typed$fn__919.invoke(typed.clj:54)
at clojure.core.typed$fn__1678.doInvoke(typed.clj:2256)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at user$eval1698$fn__1699.invoke(form-init6446670678682645381.clj:1)
at user$eval1698.invoke(form-init6446670678682645381.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.load(Compiler.java:7130)
... 11 more

子进程失败
`

5 答案

0

评论由:johanatan

上述异常调用堆栈是针对版本:0.3.3。

版本0.3.0-alpha5产生不同的异常调用堆栈

`
在“main”线程中的异常:java.lang.AssertionError:断言失败:(let [[derived-props derived-atoms] %] (and (every? (some-fn fl/ImpFilter? fl/OrFilter? fl/AndFilter?) derived-props) (every? (some-fn fl/TypeFilter? fl/NotTypeFilter?) derived-atoms))), 编译:(/private/var/folders/fg/8xpsfgln1_s0cwh3f1ksxtjr0000gq/T/form-init3689436395269879959.clj:1:124)

at clojure.lang.Compiler.load(Compiler.java:7142)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$init_opt.invoke(main.clj:279)
at clojure.main$initialize.invoke(main.clj:307)
at clojure.main$null_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:420)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)

由:java.lang.AssertionError:断言失败:(let [[derived-props derived-atoms] %] (and (every? (some-fn fl/ImpFilter? fl/OrFilter? fl/AndFilter?) derived-props) (every? (some-fn fl/TypeFilter? fl/NotTypeFilter?) derived-atoms)))

at clojure.core.typed.update$combine_props.invoke(update.clj:58)
at clojure.core.typed.check.let$check_let$fn__13761$fn__13769.invoke(let.clj:83)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:626)
at clojure.core$update_in.doInvoke(core.clj:5698)
at clojure.lang.RestFn.invoke(RestFn.java:445)
at clojure.lang.AFn.applyToHelper(AFn.java:160)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:626)
at clojure.core.contracts.constraints$apply_contract$fn__413.doInvoke(constraints.clj:174)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at clojure.core.typed.check.let$check_let$fn__13761.invoke(let.clj:79)
at clojure.core.protocols$fn__6086.invoke(protocols.clj:143)
at clojure.core.protocols$fn__6057$G__6052__6066.invoke(protocols.clj:19)
at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
at clojure.core.protocols$fn__6078.invoke(protocols.clj:54)
at clojure.core.protocols$fn__6031$G__6026__6044.invoke(protocols.clj:13)
at clojure.core$reduce.invoke(core.clj:6289)
at clojure.core.typed.check.let$check_let.doInvoke(let.clj:103)
at clojure.lang.RestFn.invoke(RestFn.java:445)
at clojure.core.typed.check$check _COLON_let14930.doInvoke(check.clj:1629)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at clojure.core.typed.check.do$check_do$fn__12802$fn__12805.invoke(do.clj:41)
at clojure.core.typed.check.do$check_do$fn__12802.invoke(do.clj:33)
at clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58)
at clojure.core.protocols$fn__6093.invoke(protocols.clj:98)
at clojure.core.protocols$fn__6057$G__6052__6066.invoke(protocols.clj:19)
at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
at clojure.core.protocols$fn__6078.invoke(protocols.clj:54)
at clojure.core.protocols$fn__6031$G__6026__6044.invoke(protocols.clj:13)
at clojure.core$reduce.invoke(core.clj:6289)
at clojure.core.typed.check.do$check_do.invoke(do.clj:61)
at clojure.core.typed.check$check _COLON_do14821.doInvoke(check.clj:1382)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at clojure.core.typed.check.fn_method_one$check_fn_method1$fn__13601.invoke(fn_method_one.clj:183)
at clojure.core.typed.check.fn_method_one$check_fn_method1.doInvoke(fn_method_one.clj:173)
at clojure.lang.RestFn.invoke(RestFn.java:464)
at clojure.core.typed.check.special.fn$check_anon$fn__13996.invoke(fn.clj:44)
at clojure.lang.AFn.applyToHelper(AFn.java:178)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$map$fn__4260.invoke(core.clj:2578)
at clojure.core$map$fn__4245.invoke(core.clj:2559)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:484)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core.protocols$seq_reduce.invoke(protocols.clj:30)
at clojure.core.protocols$fn__6078.invoke(protocols.clj:54)
at clojure.core.protocols$fn__6031$G__6026__6044.invoke(protocols.clj:13)
at clojure.core$reduce.invoke(core.clj:6289)
at clojure.core$into.invoke(core.clj:6341)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:626)
at clojure.core.contracts.constraints$apply_contract$fn__413.doInvoke(constraints.clj:175)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.core$mapv.doInvoke(core.clj:6360)
at clojure.lang.RestFn.invoke(RestFn.java:580)
at clojure.core.typed.check.special.fn$check_anon.invoke(fn.clj:31)
at clojure.core.typed.check.special.fn$check_special_fn$fn__14110.invoke(fn.clj:206)
at clojure.core.typed.check.special.fn$check_special_fn.invoke(fn.clj:199)
at clojure.core.typed.check$fn__14797.invoke(check.clj:1364)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at clojure.core.typed.check.do$check_do.invoke(do.clj:21)
at clojure.core.typed.check$check _COLON_do14821.doInvoke(check.clj:1382)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.MultiFn.invoke(MultiFn.java:227)
at clojure.core.typed.check.def$check_normal_def.doInvoke(def.clj:61)
at clojure.lang.RestFn.invoke(RestFn.java:442)
at clojure.core.typed.check$check _COLON_def14956.doInvoke(check.clj:1673)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at clojure.core.typed.check$check_expr.doInvoke(check.clj:150)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.core.typed.check$check_asts$iter__14184__14188$fn__14189$fn__14190.invoke(check.clj:119)
at clojure.core.typed.check$check_asts$iter__14184__14188$fn__14189.invoke(check.clj:118)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:484)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$dorun.invoke(core.clj:2855)
at clojure.core$doall.invoke(core.clj:2871)
at clojure.core.typed.check$check_asts.invoke(check.clj:118)
at clojure.core.typed.check.utils$check_ns_and_deps_STAR_.invoke(utils.clj:479)
at clojure.core.typed.check$check_ns_and_deps.invoke(check.clj:130)
at clojure.core.typed.check_ns_common$check_ns_info$fn__17011$fn__17012.invoke(check_ns_common.clj:82)
at clojure.core.typed.check_ns_common$check_ns_info$fn__17011.invoke(check_ns_common.clj:58)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.core.typed.check_ns_common$check_ns_info.doInvoke(check_ns_common.clj:44)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:628)
at clojure.core.typed.check_ns_common$check_ns.doInvoke(check_ns_common.clj:112)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:628)
at clojure.core.typed.check_ns_clj$check_ns.doInvoke(check_ns_clj.clj:23)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:626)
at clojure.core.typed$fn__2034.doInvoke(typed.clj:2257)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at user$eval7$fn__8.invoke(form-init3689436395269879959.clj:1)
at user$eval7.invoke(form-init3689436395269879959.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.load(Compiler.java:7130)
... 11 more

子进程失败
`

0

由 ambrosebs 发表评论:

不知道如何继续。

0

评论由:johanatan

显然,修复这个问题是我的首选。 :)

0

由 ambrosebs 发表评论:

:) 同意。

昨天我有一个模糊的想法,希望能够按名称空间粒度覆盖任何注解。为不属于你的名称空间添加此类注解似乎至少有些不合适。

至少应该改善这个错误信息。我认为它是覆盖默认的多态注解,这可能会破坏一些内部不变性。

0
参考: https://clojure.atlassian.net/browse/CTYP-242 (由 johanatan 报告)
...