Last active
February 13, 2017 07:03
-
-
Save frenchy64/d0642855cc528901d6296d26a9309ec4 to your computer and use it in GitHub Desktop.
Runtime type inference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clojure.core.typed.test.rt-infer.anon-lambda | |
{:lang :core.typed | |
:core.typed {:features #{:runtime-infer}}} | |
(:require [clojure.core.typed :as t])) | |
(defn b [coll] | |
(->> coll | |
(map (fn [n] | |
(inc n))) | |
(filter | |
(fn [n] | |
(odd? n))))) | |
(b [1 2 3 4 5]) | |
;(t/check-ns) | |
; Type Error (clojure/core/typed/test/rt_infer/anon_lambda.clj:12:12) Function clojure.core/odd? could not be applied to arguments: | |
; | |
; | |
; Domains: | |
; t/AnyInteger | |
; | |
; Arguments: | |
; t/Any | |
; | |
; Ranges: | |
; Boolean | |
; | |
; | |
; in: (clojure.core/odd? n) | |
; | |
; | |
; Type Error (clojure/core/typed/test/rt_infer/anon_lambda.clj:9:15) Static method clojure.lang.Numbers/inc could not be applied to arguments: | |
; | |
; | |
; Domains: | |
; Long | |
; Double | |
; t/AnyInteger | |
; Number | |
; | |
; Arguments: | |
; t/Any | |
; | |
; Ranges: | |
; Long | |
; Double | |
; t/AnyInteger | |
; Number | |
; | |
; | |
; in: (clojure.lang.Numbers/inc n) | |
; | |
; | |
; ExceptionInfo Type Checker: Found 2 errors clojure.core/ex-info (core.clj:4725) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clojure.core.typed.test.rt-infer.anon-lambda | |
{:lang :core.typed | |
:core.typed {:features #{:runtime-infer}}} | |
(:require [clojure.core.typed :as t])) | |
;; Start: Generated by clojure.core.typed - DO NOT EDIT | |
(declare) | |
(t/ann b [(t/Vec Long) :-> (t/Seqable Long)]) | |
;; End: Generated by clojure.core.typed - DO NOT EDIT | |
(defn b [coll] | |
(->> coll | |
(map (^::t/auto-gen t/ann-form | |
(fn [n] | |
(inc n)) | |
[Long :-> Long]) | |
) | |
(filter | |
(^::t/auto-gen t/ann-form | |
(fn [n] | |
(odd? n)) | |
[Long :-> (t/U Boolean false)]) | |
))) | |
(b [1 2 3 4 5]) | |
;(t/check-ns) | |
; Not checking clojure.core.typed (does not depend on clojure.core.typed) | |
; Start checking clojure.core.typed.test.rt-infer.anon-lambda | |
; Checked clojure.core.typed.test.rt-infer.anon-lambda in 453.387753 msecs | |
; :ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment