Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject core.typed "0.1.10-SNAPSHOT"
+(defproject core.typed "0.1.11-SNAPSHOT"
:description "Gradual typing for Clojure"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
View
6 src/main/clojure/clojure/core/typed.clj
@@ -360,7 +360,11 @@
(defprotocol ~@body)))
(defmacro loop>
- "Define a typed loop"
+ "Like loop, except loop variables require annotation.
+
+ eg. (loop> [[a :- Number] 1
+ [b :- (U nil Number)] nil]
+ ...)"
[bndings* & forms]
(let [bnds (partition 2 bndings*)
; [[lhs :- bnd-ann] rhs]
View
5 src/main/clojure/clojure/core/typed/ann.clj
@@ -42,7 +42,7 @@
[[y ... y -> x] -> [y ... y -> x]]))
(ann clojure.core/key (All [x]
- [(U '[x Any] (IMapEntry x Any)) -> x]))
+ [(IMapEntry x Any) -> x]))
;TODO flip filters
(ann clojure.core/complement (All [x] [[x -> Any] -> [x -> boolean]]))
@@ -276,6 +276,7 @@
(ann clojure.core/vector? (predicate (IPersistentVector Any)))
(ann clojure.core/nil? (predicate nil))
(ann clojure.core/symbol? (predicate Symbol))
+(ann clojure.core/map? (predicate (IPersistentMap Any Any)))
(ann clojure.core/meta (All [x]
(Fn [(IMeta x) -> x]
@@ -307,7 +308,7 @@
(ann clojure.core/seq (All [x]
(Fn
- #_[(I (Seqable x) (CountRange 1)) -> (I (ISeq x) (CountRange 1))]
+ [(I (Seqable x) (CountRange 1)) -> (I (ISeq x) (CountRange 1))]
[(Option (Seqable x)) -> (Option (I (ISeq x) (CountRange 1)))
:filters {:then (& (is (CountRange 1) 0)
(! nil 0))
View
6 src/test/clojure/clojure/core/typed/test/compiler.clj
@@ -507,11 +507,10 @@
(ann emit [Expr -> nil])
(defmulti emit :op)
-(ann emits [Any * -> nil])
+(ann emits [(U Expr nil (ISeq Expr) [-> Any] Any) * -> nil])
;weird invariants
-(tc-ignore
(defn emits [& xs]
- (doseq [x xs]
+ (doseq> [[x :- (U Expr nil (ISeq Expr) [-> Any] Any)] xs]
(cond
(nil? x) nil
(map? x) (emit x)
@@ -524,7 +523,6 @@
[line (+ column (count s))])))
(print s)))))
nil)
- )
(ann emit-str [Expr -> String])
(defn ^String emit-str [expr]

No commit comments for this range

Something went wrong with that request. Please try again.