Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.typed by

Adding the following annotation results in a runtime exception:

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

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

`

Exception:

`
$ lein typed check
Retrieving org/clojure/core.typed/0.3.3/core.typed-0.3.3.pom from central
Retrieving org/clojure/core.typed-pom/0.3.3/core.typed-pom-0.3.3.pom from central
Retrieving org/clojure/core.typed.rt/0.3.3/core.typed.rt-0.3.3.pom from central
Retrieving org/clojure/clojure/1.7.0-RC2/clojure-1.7.0-RC2.pom from central
Retrieving org/clojure/core.typed.rt/0.3.3/core.typed.rt-0.3.3.jar from central
Retrieving org/clojure/core.typed/0.3.3/core.typed-0.3.3.jar from central
Initializing core.typed ...
Building core.typed base environments ...
Exception in thread "main" java.lang.AssertionError: Assert failed: (every? r/Bounds? bbnds), compiling:(/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)

Caused by: java.lang.AssertionError: Assert failed: (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

Subprocess failed
`

5 Answers

0 votes
by

Comment made by: johanatan

The above exception call stack is for version: 0.3.3.

Version 0.3.0-alpha5 produces a different exception call stack:

`
Exception in thread "main" java.lang.AssertionError: Assert failed: (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))), compiling:(/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)

Caused by: java.lang.AssertionError: Assert failed: (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

Subprocess failed
`

0 votes
by

Comment made by: ambrosebs

Unsure how to proceed.

0 votes
by

Comment made by: johanatan

Proceeding with a fix would obviously be my first choice. :)

0 votes
by

Comment made by: ambrosebs

:) Agreed.

I had a vague idea yesterday to be able to override any annotation on a per-namespace granularity. Adding these kinds of annotations for namespaces you don't own seems a bit off at least.

This error message at least should be improved. I think it's overriding the default polymorphic annotation, which might break some internal invariants.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CTYP-242 (reported by johanatan)
...