<< Back to previous view

[CTYP-120] Can't use polymorphic records Created: 13/Mar/14  Updated: 14/Mar/14  Resolved: 14/Mar/14

Status: Closed
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Gary Fredericks Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None
Environment:

core.typed 0.2.36



 Description   

The following code fails at load time with CompilerException clojure.lang.ArityException: Wrong number of args (0) passed to: errors/int-error, compiling:

(ns polymorphic.records                                                                                                                                                                                  
  (:require [clojure.core.typed :as t]))                                                                                                                                                            

(t/ann-record [[t :variance :invariant]]                                                                                                                                                            
              Collector                                                                                                                                                                             
              [coll :- (t/Coll t)])                                                                                                                                                                 
(defrecord Collector [coll])                                                                                                                                                                        

(t/ann collector-maker                                                                                                                                                                              
       (TFn [t] [(t/Coll t) -> (Collector t)]))                                                                                                                                                     
(defn collector-maker                                                                                                                                                                               
  [coll]
  (->Collector coll))


 Comments   
Comment by Gary Fredericks [ 13/Mar/14 9:49 AM ]

I see that s/TFn/All/ makes this load without incident and type-check; I guess that was the real problem?

Comment by Ambrose Bonnaire-Sergeant [ 14/Mar/14 7:15 AM ]

Fixed https://github.com/clojure/core.typed/commit/815225d5f4123b0adb2a10dd097a806d6cd28b71

Generated at Tue Oct 21 15:30:33 CDT 2014 using JIRA 4.4#649-r158309.