New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infer types #1

Open
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+162 −8
Diff settings

Always

Just for now

@@ -19,6 +19,160 @@
(:import (java.io PrintWriter PushbackReader StringWriter
Writer StringReader EOFException)))
;; Start: Generated by clojure.core.typed - DO NOT EDIT
(declare a-b)
(t/defalias a-b (t/Map t/Any t/Any))
(t/ann
-read
[PushbackReader
Boolean
(t/U nil ':clojure.data.json-test/eof)
:->
t/Any])
(t/ann JSONWriter (t/Map t/Nothing t/Nothing))
(t/ann
codepoint-clause
[(t/Coll t/Any)
:->
'[(t/U t/Int (t/Coll t/Int)) (t/U (t/Coll t/Any) Character)]])
(t/ann default-value-fn [(t/U t/Str t/Int ':a ':b) t/Any :-> t/Any])
(t/ann
default-write-key-fn
[(t/U nil t/Str ':c t/Int ':d ':double ':a ':e ':f ':b) :-> t/Str])
(t/ann
pprint
(t/IFn
[t/Str ':escape-unicode false :-> nil]
[(t/Vec t/Any) :-> nil]))
(t/ann pprint-array [(t/Vec t/Any) :-> nil])
(t/ann pprint-dispatch [t/Any :-> nil])
(t/ann pprint-generic [(t/U t/Str Boolean t/Num) :-> nil])
(t/ann pprint-object [(t/Map t/Str t/Any) :-> nil])
(t/ann
read
(t/IFn
[StringReader
(t/U ':eof-error? ':key-fn)
(t/U [t/Str :-> (t/U ':number ':date)] false)
(t/U ':value-fn ':eof-value)
(t/U
[? ? :-> Object]
[':date (t/U t/Str t/Int) :-> (t/U Object t/Int java.sql.Date)]
':clojure.data.json-test/eof
[(t/U ':number ':date)
(t/U t/Str t/Int)
:->
(t/U Object t/Int java.sql.Date)])
:->
t/Any]
[StringReader
(t/U ':bigdec ':key-fn)
(t/U Boolean [t/Str :-> (t/U ':a ':b)] [? :-> ':a] AnyFunction)
:->
(t/U a-b BigDecimal)]
[(t/U PushbackReader StringReader) :-> t/Any]))
(t/ann read-array [PushbackReader :-> (t/Vec t/Any)])
(t/ann read-decimal [t/Str :-> (t/U Double BigDecimal)])
(t/ann read-escaped-char [PushbackReader :-> Character])
(t/ann read-hex-char [PushbackReader :-> Character])
(t/ann read-integer [t/Str :-> (t/U t/Int clojure.lang.BigInt)])
(t/ann
read-number
[PushbackReader :-> (t/U t/Num clojure.lang.BigInt BigDecimal)])
(t/ann read-object [PushbackReader :-> (t/Map t/Str t/Any)])
(t/ann read-quoted-string [PushbackReader :-> t/Str])
(t/ann
read-str
(t/IFn
[t/Str :-> t/Any]
[t/Str
(t/U ':eof-error? ':key-fn)
(t/U
[t/Str :-> (t/U ':number ':date)]
false
[? :-> ':date]
AnyFunction)
(t/U ':value-fn ':eof-value)
(t/U
':clojure.data.json-test/eof
[(t/U ':number ':date)
(t/U t/Str t/Int)
:->
(t/U Object t/Int java.sql.Date)]
AnyFunction)
:->
t/Any]
[t/Str
(t/U ':bigdec ':key-fn)
(t/U
Boolean
[t/Str :-> (t/U ':a ':b)]
[t/Str :-> ':a]
[? :-> ':a]
AnyFunction)
:->
(t/U a-b BigDecimal)]))
(t/ann value-fn-sentinel Object)
(t/ann
write
(t/IFn
[t/Any StringWriter :-> nil]
[t/Any
StringWriter
(t/U ':escape-unicode ':value-fn ':escape-js-separators)
(t/U
[(t/U ':c ':e ':f) t/Num :-> Object]
[(t/U ':c ':d ':double ':a ':e ':f ':b)
(t/U nil t/Num)
:->
(t/U Object t/Str t/Int)]
Boolean
[(t/U ':c ':f) ? :-> ?])
:->
nil]))
(t/ann
write-array
[(t/U (t/Set t/Int) (t/Coll (t/U nil t/Int))) PrintWriter :-> nil])
(t/ann
write-bignum
[(t/U clojure.lang.BigInt BigDecimal) PrintWriter :-> nil])
(t/ann write-double [Double PrintWriter :-> nil])
(t/ann write-float [Float PrintWriter :-> ?])
(t/ann write-generic [(Array t/Int) PrintWriter :-> nil])
(t/ann write-named [t/Sym PrintWriter :-> nil])
(t/ann write-null [nil PrintWriter :-> nil])
(t/ann
write-object
[(t/Map (t/U nil t/Str t/Int) t/Int) PrintWriter :-> nil])
(t/ann write-plain [(t/U t/Int Boolean) PrintWriter :-> nil])
(t/ann write-ratio [clojure.lang.Ratio PrintWriter :-> nil])
(t/ann
write-str
(t/IFn
[t/Any :-> t/Str]
[t/Any
(t/U ':escape-unicode ':value-fn ':escape-js-separators)
(t/U
[(t/U ':c ':d ':a ':e ':b)
(t/U nil t/Num)
:->
(t/U Object t/Str t/Int)]
[? t/Int :-> ?]
[(t/U ':c ':d ':a ':e ':f ':b)
(t/U nil t/Num)
:->
(t/U Object t/Str t/Int)]
[(t/U ':c ':d ':double ':a ':e ':f ':b)
(t/U nil t/Num)
:->
(t/U Object t/Str t/Int)]
Boolean
AnyFunction)
:->
t/Str]))
(t/ann write-string [t/Str PrintWriter :-> nil])
(t/ann clojure.pprint/pprint [t/Any :-> nil])
;; End: Generated by clojure.core.typed - DO NOT EDIT
;;; JSON READER
(defonce value-fn-sentinel (Object.))
@@ -65,7 +219,7 @@
(defn- read-array [^PushbackReader stream]
;; Expects to be called with the head of the stream AFTER the
;; opening bracket.
(loop [result (transient [])]
(loop [^{::t/ann (clojure.lang.ITransientVector t/Any)} result (transient [])]
(let [c (.read stream)]
(when (neg? c)
(throw (EOFException. "JSON error (end-of-file inside array)")))
@@ -80,7 +234,7 @@
(defn- read-object [^PushbackReader stream]
;; Expects to be called with the head of the stream AFTER the
;; opening bracket.
(loop [key nil, result (transient {})]
(loop [^{::t/ann (t/U nil t/Str)} key nil, ^{::t/ann (t/U clojure.lang.PersistentHashMap$TransientHashMap clojure.lang.PersistentArrayMap$TransientArrayMap)} result (transient {})]
(let [c (.read stream)]
(when (neg? c)
(throw (EOFException. "JSON error (end-of-file inside object)")))
@@ -166,7 +320,7 @@
(defn- read-number [^PushbackReader stream]
(let [buffer (StringBuilder.)
decimal? (loop [decimal? false]
decimal? (loop [^{::t/ann Boolean} decimal? false]
(let [c (.read stream)]
(codepoint-case c
(\- \+ \0 \1 \2 \3 \4 \5 \6 \7 \8 \9)
@@ -297,7 +451,7 @@
(defn- write-string [^CharSequence s ^PrintWriter out]
(let [sb (StringBuilder. (count s))]
(.append sb \")
(dotimes [i (count s)]
(dotimes [^{::t/ann t/Int} i (count s)]
(let [cp (int (.charAt s i))]
(codepoint-case cp
;; Printable JSON escapes
@@ -325,7 +479,7 @@
(defn- write-object [m ^PrintWriter out]
(.print out \{)
(loop [x m, have-printed-kv false]
(loop [^{::t/ann (t/U (t/Map (t/U nil t/Str t/Int) t/Int) (t/Coll '[(t/U ':c t/Int ':d ':e ':f ':b) (t/U nil t/Int)]))} x m, ^{::t/ann Boolean} have-printed-kv false]
(when (seq m)
(let [[k v] (first x)
out-key (*key-fn* k)
@@ -349,7 +503,7 @@
(defn- write-array [s ^PrintWriter out]
(.print out \[)
(loop [x s]
(loop [^{::t/ann (t/U (t/Set t/Int) (t/Coll (t/U nil t/Int)))} x s]
(when (seq x)
(let [fst (first x)
nxt (next x)]
@@ -499,7 +653,7 @@
(defn- pprint-object [m]
((pprint/formatter-out "~<{~;~@{~<~w:~_~w~:>~^, ~_~}~;}~:>")
(for [[k v] m] [(*key-fn* k) v])))
(for ^{::t/ann '[t/Str t/Any]} [^{::t/ann '[t/Str t/Any]} [k v] m] [(*key-fn* k) v])))
(defn- pprint-generic [x]
(if (.isArray (class x))
@@ -533,4 +687,4 @@
;; Local Variables:
;; mode: clojure
;; eval: (define-clojure-indent (codepoint-case (quote defun)))
;; End:
;; End: