Permalink
Browse files

Iterable is now (Seqable Any). Fixes CTYP-30

  • Loading branch information...
1 parent 8791bce commit 9bb6ef544f57d17ff8a57abd142ca8c724aebb08 @frenchy64 frenchy64 committed Aug 1, 2013
@@ -459,6 +459,10 @@ java.lang.CharSequence [[]
java.lang.String [[]
:unchecked-ancestors
#{(Seqable Character)}]
+
+java.lang.Iterable [[]
+ :unchecked-ancestors
+ #{(Seqable Any)}]
))
(rcls/reset-rclass-env! init-altered-env)
@@ -441,6 +441,8 @@
v))
)
+(declare make-simple-substitution)
+
(t/ann ^:nocheck RClass-replacements* [RClass -> (IPersistentMap Symbol TCType)])
(defn RClass-replacements*
"Return the replacements map for the RClass"
@@ -455,7 +457,7 @@
(into {} (for [[k v] (.replacements rcls)]
(let [t (instantiate-many names v)
_ (assert (r/Type? t))
- subst (infer (zipmap names (repeat r/no-bounds)) {} poly fs t)]
+ subst (make-simple-substitution names poly)]
[k (subst-all subst t)])))))
(t/ann ^:nocheck RClass-unchecked-ancestors* [RClass -> (IPersistentSet TCType)])
@@ -470,7 +472,7 @@
fs (map r/make-F names)]
(set (for [u (.unchecked-ancestors rcls)]
(let [t (instantiate-many names u)
- subst (infer (zipmap names (repeat r/no-bounds)) {} poly fs t)]
+ subst (make-simple-substitution names poly)]
(subst-all subst t))))))
;TODO won't type check because records+destructuring
@@ -1657,6 +1657,14 @@
(make-CountRange 1))
)))
+(deftest iterable-as-seqable-test
+ (is (cf (first (clojure.core.typed/ann-form [] Iterable)))))
+
+;(deftest intersect-RClass-ancestors-test
+; (is (= (In (RClass-of IPersistentSet [-any])
+; (RClass-of Seqable [(RClass-of Number)]))
+; (RClass-of IPersistentSet [-any]))))
+
;TODO destructuring on records
;TODO does this instance lookup work? (cf (.the-class (->RClass ...)))
;TODO unmunge fields (.other-keys? hmap)

0 comments on commit 9bb6ef5

Please sign in to comment.