Skip to:
If I try to annotate external protocol, I get exception (CTYP-277).
Example to reproduce problem:
(ns my.tst-typed (:require [clojure.core.typed :as t] [com.stuartsierra.component :as component])) (t/ann-protocol ^:no-check component/Lifecycle start [component/Lifecycle -> component/Lifecycle] stop [component/Lifecycle -> component/Lifecycle]) (t/defprotocol My (all-records [this :- My] :- (t/Seq String))) (t/ann-record TestConnection [hosts :- (t/Seq String) db :- String connection :- String]) (defrecord TestConnection [hosts db connection] component/Lifecycle (start [component] (let [connection (str hosts db)] (assoc component :connection connection))) (stop [component] (when connection (assoc component :connection nil))) My (all-records [this] "Returns all records from database" (list "1" "2")))
Looks like type annotation doesn't apply to target protocol.
Clojure 1.7.0
ann-protocol takes a fully qualified protocol name, aliases not supported.
If I try to annotate external protocol, I get exception (CTYP-277).
Example to reproduce problem:
(ns my.tst-typed (:require [clojure.core.typed :as t] [com.stuartsierra.component :as component])) (t/ann-protocol ^:no-check component/Lifecycle start [component/Lifecycle -> component/Lifecycle] stop [component/Lifecycle -> component/Lifecycle]) (t/defprotocol My (all-records [this :- My] :- (t/Seq String))) (t/ann-record TestConnection [hosts :- (t/Seq String) db :- String connection :- String]) (defrecord TestConnection [hosts db connection] component/Lifecycle (start [component] (let [connection (str hosts db)] (assoc component :connection connection))) (stop [component] (when connection (assoc component :connection nil))) My (all-records [this] "Returns all records from database" (list "1" "2")))
Looks like type annotation doesn't apply to target protocol.