Permalink
Browse files

Fix CTYP-84

HList ancestors
  • Loading branch information...
1 parent 2d6feea commit aa4058ec77ceeb8cbfdd9b468ff1a4fbfaa41ad8 @frenchy64 frenchy64 committed Oct 6, 2013
@@ -409,16 +409,18 @@
(r/HeterogeneousList? s)
(let [ss (apply c/Un (:types s))]
- (subtype (impl/impl-case
- :clojure (c/RClass-of PersistentList [ss])
- :cljs (c/Protocol-of 'cljs.core/IList [ss]))
+ (subtype (c/In (impl/impl-case
+ :clojure (c/RClass-of PersistentList [ss])
+ :cljs (c/Protocol-of 'cljs.core/IList [ss]))
+ (r/make-ExactCountRange (count (:types s))))
t))
(r/HeterogeneousSeq? s)
(let [ss (apply c/Un (:types s))]
- (subtype (impl/impl-case
- :clojure (c/RClass-of ASeq [ss])
- :cljs (c/Protocol-of 'cljs.core/ISeq [ss]))
+ (subtype (c/In (impl/impl-case
+ :clojure (c/RClass-of ASeq [ss])
+ :cljs (c/Protocol-of 'cljs.core/ISeq [ss]))
+ (r/make-ExactCountRange (count (:types s))))
t))
; The order of checking protocols and datatypes is subtle.
@@ -2345,6 +2345,9 @@
(deftest comparable-inline-test
(is-cf (fn [v x] (compare v x)) (Fn [Comparable Any -> Number])))
+(deftest CTYP-84-hlist-ancestor-test
+ (is-cf (seq '(1)) (clojure.core.typed/NonEmptySeq Number)))
+
;(reset-caches)
;(chk/abstract-result

0 comments on commit aa4058e

Please sign in to comment.