Created
April 11, 2013 16:02
-
-
Save frenchy64/5364660 to your computer and use it in GitHub Desktop.
core.typed keyword parameters
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.kw-args | |
(:require [clojure.core.typed :refer [ann check-ns ann-form cf]] | |
[clojure.tools.analyzer :refer [ast]] | |
[clojure.tools.analyzer.emit-form :refer [emit-form]])) | |
(ann foo-kw [& {:a Number} -> (U nil Number)]) | |
(defn foo-kw [& {:keys [a]}] | |
(when a | |
(inc a))) | |
(fn [] (foo-kw :a 1)) | |
(fn [] (foo-kw :a 'a)) | |
Exception Type Error, clojure.core.typed.test.kw-args:12 | |
Actual type | |
(Value a) | |
is not a subtype of Expected type | |
java.lang.Number | |
Form: (clojure.core.typed.test.kw-args/foo-kw :a (quote a)) clojure.core.typed.subtype/type-error (subtype.clj:38) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment