<< Back to previous view

[CTYP-197] No matching arities when defining multiple arity protocol method Created: 25/Jan/15  Updated: 03/Dec/17

Status: Open
Project: core.typed
Component/s: None
Affects Version/s: 0.2
Fix Version/s: Backlog

Type: Defect Priority: Major
Reporter: Joshua Griffith Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: bug, defprotocol, deftype

Clojure 1.6.0 and 1.7.0-alpha5

Attachments: File arity.clj     Text File typecheck.log    


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.

Comment by Johan Gall [ 08/May/15 1:18 AM ]

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
   [a] :- Any
   [a b :- Any] :- Any))
(t/ann-record R [])
(defrecord R []
  (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

Generated at Thu Apr 18 21:38:32 CDT 2019 using JIRA 4.4#649-r158309.