Permalink
Browse files

[CTYP-28] Support clojure.core/future

  • Loading branch information...
1 parent 2dd93b6 commit 2c680c825c2a946f78f6ceccc4245bfbc912c4c1 @frenchy64 frenchy64 committed Aug 28, 2013
@@ -850,7 +850,8 @@ clojure.core/re-seq [java.util.regex.Pattern String -> (LazySeq (U nil String (V
clojure.core/subs (Fn [String AnyInteger -> String]
[String AnyInteger AnyInteger -> String])
-clojure.core/future-call [[-> Any] -> Any]
+clojure.core/future-call (All [x] [[-> x] -> (Extends [(IDeref x)
+ java.util.concurrent.Future])])
clojure.core/atom (All [x]
[x & :optional {:validator (U nil [x -> Any]) :meta Any}-> (Atom x x)])
@@ -201,7 +201,7 @@
(parse-type '(Rec [x] (U Integer (clojure.lang.Seqable x)))))))
(is-clj (sub? (HMap :mandatory {:op (Value :if)
:test (HMap :mandatory {:op (Value :var)
- :var clojure.lang.Var})
+ :var (clojure.lang.Var Any)})
:then (HMap :mandatory {:op (Value :nil)})
:else (HMap :mandatory {:op (Value :false)})})
(Rec [x]
@@ -210,7 +210,7 @@
:then x
:else x})
(HMap :mandatory {:op (Value :var)
- :var clojure.lang.Var})
+ :var (clojure.lang.Var Any)})
(HMap :mandatory {:op (Value :nil)})
(HMap :mandatory {:op (Value :false)})))))
@@ -1857,6 +1857,10 @@
(is (cf (#'+ 1 2)))
(is (sub? (Var [-> nil]) [-> nil])))
+(deftest future-test
+ (is (cf @(future 'a) clojure.lang.Symbol))
+ (is (cf (future 'a) java.util.concurrent.Future)))
+
;(reset-caches)
;(chk/abstract-result
@@ -0,0 +1,28 @@
+(ns clojure.core.typed.test.rec-protocol
+ (:require [clojure.core.typed :as t :refer [ann-protocol ann-datatype defprotocol> check-ns]]))
+
+(ann-protocol SelfProtocol
+ f1 [SelfProtocol -> (U nil SelfProtocol)])
+(defprotocol> SelfProtocol
+ (f1 [this]))
+
+;(declare-protocol
+; [[f :variance :covariant]]
+; HOProtocol1)
+;
+;Foo <: (HOProtocol2 Foo)
+;Foo <: (HOProtocol2 Foo)
+
+(ann-protocol [[f :variance :covariant
+ :< (HOProtocol2 f)]]
+ HOProtocol2)
+ ;my-method
+; [(HOProtocol2 Id) ->
+; (U (HOProtocol1 (TFn [[x :variance :covariant]]
+; Integer))
+; (HOProtocol1 (TFn [[x :variance :covariant]]
+; Number)))])
+
+(ann-protocol [[f :variance :covariant
+ :< (HOProtocol1 Any)]]
+ HOProtocol1)

0 comments on commit 2c680c8

Please sign in to comment.