core.typed

No matching arities when defining multiple arity protocol method

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 0.2
  • Fix Version/s: Backlog
  • Component/s: None
  • Environment:
    Clojure 1.6.0 and 1.7.0-alpha5

Description

When defining multiple-arity protocol methods with clojure.core.typed/defprotocol, deftypes implementing these methods fail to typecheck with "No matching arities" errors. See attached test case.

  1. typecheck.log
    25/Jan/15 4:37 PM
    0.6 kB
    Joshua Griffith
  2. arity.clj
    25/Jan/15 4:37 PM
    0.3 kB
    Joshua Griffith

Activity

Hide
Johan Gall added a comment - - edited

i found a quite similar problem with defrecord. Is there some kind of workaround?

project.clj http://pastebin.com/bn6giuvH
core_typed_bug/core.clj http://pastebin.com/JjfhWLSH
error message http://pastebin.com/djsAicd1

with clojure 1.7.0-beta2 and core.typed 0.2.87

(ns core-typed-bug.core
  (:require [ clojure.core.typed :as t ]))
 
(t/defprotocol P
  (f
   [a] :- Any
   [a b :- Any] :- Any))
 
(t/ann-record R [])
(defrecord R []
  P
  (f [a] 1)
  (f [a b] 2))

will give the following arity related errors:

Collected 1 namespaces in 758.831468 msecs
Not checking clojure.core.typed (does not depend on clojure.core.typed)
Start checking core-typed-bug.core
10:  Not checking core-typed-bug.core/->R definition
Checked core-typed-bug.core in 923.152062 msecs
Checked 2 namespaces  in 1702.704416 msecs
Type Error (core_typed_bug/core.clj:10:1) No matching arities: [R t/Any -> t/Any]
in: (f [a] 1)
 
 
Type Error (core_typed_bug/core.clj:10:1) No matching arities: [R -> t/Any] in: (f [a b] 2)
 
 
Type Checker: Found 2 errors
Found errors
Show
Johan Gall added a comment - - edited i found a quite similar problem with defrecord. Is there some kind of workaround? project.clj http://pastebin.com/bn6giuvH core_typed_bug/core.clj http://pastebin.com/JjfhWLSH error message http://pastebin.com/djsAicd1 — with clojure 1.7.0-beta2 and core.typed 0.2.87
(ns core-typed-bug.core
  (:require [ clojure.core.typed :as t ]))
 
(t/defprotocol P
  (f
   [a] :- Any
   [a b :- Any] :- Any))
 
(t/ann-record R [])
(defrecord R []
  P
  (f [a] 1)
  (f [a b] 2))

will give the following arity related errors:

Collected 1 namespaces in 758.831468 msecs
Not checking clojure.core.typed (does not depend on clojure.core.typed)
Start checking core-typed-bug.core
10:  Not checking core-typed-bug.core/->R definition
Checked core-typed-bug.core in 923.152062 msecs
Checked 2 namespaces  in 1702.704416 msecs
Type Error (core_typed_bug/core.clj:10:1) No matching arities: [R t/Any -> t/Any]
in: (f [a] 1)
 
 
Type Error (core_typed_bug/core.clj:10:1) No matching arities: [R -> t/Any] in: (f [a b] 2)
 
 
Type Checker: Found 2 errors
Found errors

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated: