Details
Assignee
UnassignedUnassignedReporter
importimportComponents
Fix versions
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
import
importComponents
Fix versions
Affects versions
Priority

Created September 16, 2015 at 9:36 PM
Updated December 4, 2017 at 12:04 AM
When I try to typecheck record, that implements untyped protocol, I get internal assertion error. Minimal example:
(defprotocol Lifecycle (start [component]) (stop [component])) (t/ann-record TestRec [host :- String port :- Integer connection :- String]) (defrecord TestRec [host port connection] Lifecycle (start [component] (let [connection (str "Host: " host ", port: " port)] (assoc component :connection connection))) (stop [component] (.close connection)))
Exception:
java.lang.AssertionError: Assert failed: (every? r/Type? types) at clojure.core.typed.type_ctors$In.doInvoke (type_ctors.clj:498) clojure.lang.RestFn.applyTo (RestFn.java:137) clojure.core$apply.invoke (core.clj:630) clojure.core.typed.assoc_utils/fn (assoc_utils.clj:40) clojure.core.typed.assoc_utils$fn__10$G__5__17.invoke (assoc_utils.clj:25) clojure.core.typed.type_ctors$reduce_type_transform$fn__7210$iter__7211__7217$fn__7218.invoke (type_ctors.clj:2200) clojure.lang.LazySeq.sval (LazySeq.java:40) clojure.lang.LazySeq.seq (LazySeq.java:49) clojure.lang.RT.seq (RT.java:507) clojure.core/seq (core.clj:137) clojure.core$some.invoke (core.clj:2569) clojure.core.typed.type_ctors$union_or_nil.invoke (type_ctors.clj:2180) clojure.core.typed.type_ctors$reduce_type_transform.doInvoke (type_ctors.clj:2195) clojure.lang.RestFn.invoke (RestFn.java:494)
Debug print in error position:
(:types new-i) => #{{:the-class clojure.core.typed.test.records3.TestRec, :variances nil, :poly? nil, :fields {host {:id java.lang.String}, port {:id java.lang.Integer}, connection {:id java.lang.String}}, :record? true} {:variances nil, :poly? nil, :the-class clojure.core.typed.test.records3.Lifecycle}} (map #(assoc-type-pairs % assoc-entry) (:types new-i)) => ({:the-class clojure.core.typed.test.records3.TestRec, :variances nil, :poly? nil, :fields {host {:id java.lang.String}, port {:id java.lang.Integer}, connection {:id java.lang.String}}, :record? true} nil)