macros which define functions containing named anonymous functions crash

Description

1 2 3 4 5 6 (defmacro deft [name args & body] `(defn ~name [] (fn build [] ~@body))) (ann foo (IFn [Any nil -> Any])) (deft foo [x] 2)

throws an exception complaining about a missing lexical environment, which can be fixed by unquote-splicing the quoted name: ~'build instead of build.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 ERROR in (typecheck) (lex_env.clj:12) expected: (check-ns (quote tesser.core)) actual: java.lang.AssertionError: Pre-condition failure: A lexical environment l, props is a list of known propositions Assert failed: (lex-env? l) at clojure.core.typed.lex_env$__GT_PropEnv$chk_PropEnv__11227$fn__11229.invoke (lex_env.clj:12) clojure.core.typed.lex_env$__GT_PropEnv$chk_PropEnv__11227.invoke (lex_env.clj:12) clojure.lang.AFn.applyToHelper (AFn.java:156) clojure.lang.AFn.applyTo (AFn.java:144) clojure.lang.AFunction$1.doInvoke (AFunction.java:29) clojure.lang.RestFn.applyTo (RestFn.java:137) clojure.core$apply.invoke (core.clj:626) clojure.core$partial$fn__4228.doInvoke (core.clj:2468) clojure.lang.RestFn.invoke (RestFn.java:408) clojure.core.contracts.constraints$apply_contract$fn__1927.doInvoke (constraints.clj:174) clojure.lang.RestFn.applyTo (RestFn.java:137) clojure.lang.AFunction$1.doInvoke (AFunction.java:29) clojure.lang.RestFn.invoke (RestFn.java:436) clojure.core$update_in.doInvoke (core.clj:5698) clojure.lang.RestFn.invoke (RestFn.java:445) clojure.lang.AFn.applyToHelper (AFn.java:160) clojure.lang.RestFn.applyTo (RestFn.java:132) clojure.core$apply.invoke (core.clj:626) clojure.core.contracts.constraints$apply_contract$fn__1927.doInvoke (constraints.clj:174) clojure.lang.RestFn.applyTo (RestFn.java:137) clojure.lang.AFunction$1.doInvoke (AFunction.java:29) clojure.lang.RestFn.invoke (RestFn.java:436) clojure.core.typed.lex_env$merge_locals.invoke (lex_env.clj:35) clojure.core.typed.check.fn_methods$check_fn_methods.doInvoke (fn_methods.clj:48) clojure.lang.RestFn.invoke (RestFn.java:464) clojure.core.typed.check.fn$check_fn.invoke (fn.clj:25) clojure.core.typed.check$check _COLON_fn22307$fn__22317.invoke (check.clj:1282) clojure.core.typed.check$check _COLON_fn22307.doInvoke (check.clj:1255) clojure.lang.RestFn.invoke (RestFn.java:423) clojure.lang.MultiFn.invoke (MultiFn.java:231) clojure.core.typed.check$check _COLON_with_meta22482.doInvoke (check.clj:1589) clojure.lang.RestFn.invoke (RestFn.java:423) clojure.lang.MultiFn.invoke (MultiFn.java:231) clojure.core.typed.check.do$check_do$fn__21306$fn__21309.invoke (do.clj:40) clojure.core.typed.check.do$check_do$fn__21306.invoke (do.clj:32) clojure.lang.ArrayChunk.reduce (ArrayChunk.java:58) clojure.core.protocols/fn (protocols.clj:98) clojure.core.protocols$fn__6057$G__6052__6066.invoke (protocols.clj:19) clojure.core.protocols$seq_reduce.invoke (protocols.clj:31) clojure.core.protocols/fn (protocols.clj:54) clojure.core.protocols$fn__6031$G__6026__6044.invoke (protocols.clj:13) clojure.core$reduce.invoke (core.clj:6289) clojure.core.typed.check.do$check_do.invoke (do.clj:69) clojure.core.typed.check$check _COLON_do22363.doInvoke (check.clj:1330) clojure.lang.RestFn.invoke (RestFn.java:423) clojure.lang.MultiFn.invoke (MultiFn.java:231) clojure.core.typed.check.fn_method_one$check_fn_method1$fn__21492.invoke (fn_method_one.clj:179) clojure.core.typed.check.fn_method_one$check_fn_method1.doInvoke (fn_method_one.clj:169) clojure.lang.RestFn.invoke (RestFn.java:464) clojure.core.typed.check.fn_method$check_fn_method.doInvoke (fn_method.clj:26) clojure.lang.RestFn.invoke (RestFn.java:464) clojure.core.typed.check.fn_methods$check_fn_methods$fn__21544$fn__21551.invoke (fn_methods.clj:62) clojure.core$mapv$fn__6311.invoke (core.clj:6353) clojure.lang.ArrayChunk.reduce (ArrayChunk.java:58) clojure.core.protocols/fn (protocols.clj:98) clojure.core.protocols$fn__6057$G__6052__6066.invoke (protocols.clj:19) clojure.core.protocols$seq_reduce.invoke (protocols.clj:31) clojure.core.protocols/fn (protocols.clj:60) clojure.core.protocols$fn__6031$G__6026__6044.invoke (protocols.clj:13) clojure.core$reduce.invoke (core.clj:6289) clojure.core$mapv.invoke (core.clj:6353) clojure.core.typed.check.fn_methods$check_fn_methods$fn__21544.invoke (fn_methods.clj:60) clojure.core.typed.check.fn_methods$check_fn_methods.doInvoke (fn_methods.clj:45) clojure.lang.RestFn.invoke (RestFn.java:464) clojure.core.typed.check.fn$check_fn.invoke (fn.clj:25) clojure.core.typed.check$check _COLON_fn22307$fn__22317.invoke (check.clj:1282) clojure.core.typed.check$check _COLON_fn22307.doInvoke (check.clj:1255) clojure.lang.RestFn.invoke (RestFn.java:423) clojure.lang.MultiFn.invoke (MultiFn.java:231) clojure.core.typed.check.def$check_normal_def$fn__11342.invoke (def.clj:31) clojure.core.typed.check.def$check_normal_def.doInvoke (def.clj:29) clojure.lang.RestFn.invoke (RestFn.java:442) clojure.core.typed.check$check _COLON_def22496.doInvoke (check.clj:1624) clojure.lang.RestFn.invoke (RestFn.java:423) clojure.lang.MultiFn.invoke (MultiFn.java:231) clojure.core.typed.check$check_expr.doInvoke (check.clj:148) clojure.lang.RestFn.invoke (RestFn.java:410) clojure.core.typed.check$check_asts$iter__21742__21746$fn__21747$fn__21748.invoke (check.clj:117) clojure.core.typed.check$check_asts$iter__21742__21746$fn__21747.invoke (check.clj:116) clojure.lang.LazySeq.sval (LazySeq.java:40) clojure.lang.LazySeq.seq (LazySeq.java:49) clojure.lang.RT.seq (RT.java:484) clojure.core$seq.invoke (core.clj:133) clojure.core$dorun.invoke (core.clj:2855) clojure.core$doall.invoke (core.clj:2871) clojure.core.typed.check$check_asts.invoke (check.clj:116) clojure.core.typed.check.utils$check_ns_and_deps_STAR_.invoke (utils.clj:472) clojure.core.typed.check$check_ns_and_deps.invoke (check.clj:128) clojure.core.typed.check_ns_common$check_ns_info$fn__25014$fn__25015.invoke (check_ns_common.clj:81) clojure.core.typed.check_ns_common$check_ns_info$fn__25014.invoke (check_ns_common.clj:57) clojure.lang.AFn.applyToHelper (AFn.java:152) clojure.lang.AFn.applyTo (AFn.java:144) clojure.core$apply.invoke (core.clj:624) clojure.core$with_bindings_STAR_.doInvoke (core.clj:1862) clojure.lang.RestFn.invoke (RestFn.java:425) clojure.core.typed.check_ns_common$check_ns_info.doInvoke (check_ns_common.clj:42) clojure.lang.RestFn.invoke (RestFn.java:425) clojure.lang.AFn.applyToHelper (AFn.java:156) clojure.lang.RestFn.applyTo (RestFn.java:132) clojure.core$apply.invoke (core.clj:628) clojure.core.typed.check_ns_common$check_ns.doInvoke (check_ns_common.clj:111) clojure.lang.RestFn.invoke (RestFn.java:425) clojure.lang.AFn.applyToHelper (AFn.java:156) clojure.lang.RestFn.applyTo (RestFn.java:132) clojure.core$apply.invoke (core.clj:628) clojure.core.typed.check_ns_clj$check_ns.doInvoke (check_ns_clj.clj:23) clojure.lang.RestFn.invoke (RestFn.java:410) clojure.lang.AFn.applyToHelper (AFn.java:154) clojure.lang.RestFn.applyTo (RestFn.java:132) clojure.core$apply.invoke (core.clj:626) clojure.core.typed$check_ns.doInvoke (typed.clj:2225) clojure.lang.RestFn.invoke (RestFn.java:410) clojure.lang.AFn.applyToHelper (AFn.java:154) clojure.lang.RestFn.applyTo (RestFn.java:132) clojure.core$apply.invoke (core.clj:624) tesser.core_test/fn (core_test.clj:19) clojure.test$test_var$fn__7187.invoke (test.clj:704) clojure.test$test_var.invoke (test.clj:704) clojure.test$test_vars$fn__7209$fn__7214.invoke (test.clj:722) clojure.test$default_fixture.invoke (test.clj:674) clojure.test$test_vars$fn__7209.invoke (test.clj:722) clojure.test$default_fixture.invoke (test.clj:674) clojure.test$test_vars.invoke (test.clj:718) clojure.test$test_all_vars.invoke (test.clj:728) clojure.test$test_ns.invoke (test.clj:747) clojure.core$map$fn__4245.invoke (core.clj:2559) clojure.lang.LazySeq.sval (LazySeq.java:40) clojure.lang.LazySeq.seq (LazySeq.java:49) clojure.lang.Cons.next (Cons.java:39) clojure.lang.RT.boundedLength (RT.java:1654) clojure.lang.RestFn.applyTo (RestFn.java:130) clojure.core$apply.invoke (core.clj:626) clojure.test$run_tests.doInvoke (test.clj:762) clojure.lang.RestFn.invoke (RestFn.java:408) com.aphyr.prism$autotest_BANG_$fn__228.invoke (prism.clj:130) com.aphyr.prism$namespace_changed$fn__209.invoke (prism.clj:90) com.aphyr.prism$namespace_changed.invoke (prism.clj:88) com.aphyr.prism$watch_BANG_$fn__214$fn__215.invoke (prism.clj:111) clojure.core$binding_conveyor_fn$fn__4145.invoke (core.clj:1910) clojure.lang.AFn.call (AFn.java:18) java.util.concurrent.FutureTask.run (FutureTask.java:262) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615) java.lang.Thread.run (Thread.java:745)

Environment

None

Status

Assignee

Ambrose BS

Reporter

Kyle Kingsbury

Labels

Approval

None

Patch

None

Fix versions

Priority

Minor
Configure