Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 9bb6ef544f57d17ff8a57abd142ca8c724aebb08 1 parent 8791bce
@frenchy64 frenchy64 authored
View
4 src/main/clojure/clojure/core/typed/base_env.clj
@@ -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)
View
6 src/main/clojure/clojure/core/typed/type_ctors.clj
@@ -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
View
8 src/test/clojure/clojure/core/typed/test/core.clj
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.