Uploaded image for project: 'core.typed'
  1. CTYP-278

Impossible to annotate protocol in other namespace

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Declined
    • Affects versions: 0.3.11
    • Fix versions: Backlog
    • Components: Clojure Checker
    • Labels:
      None
    • Environment:

      Clojure 1.7.0

      Description

      If I try to annotate external protocol, I get exception ( CTYP-277 Open ).

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alex+import import
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: