Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nonliteral keyword as function
- Loading branch information
Showing
4 changed files
with
57 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
15 changes: 15 additions & 0 deletions
15
src/test/clojure/clojure/core/typed/test/non_literal_val_fn.clj
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(ns clojure.core.typed.test.non-literal-val-fn | ||
(:require [clojure.core.typed :as t]) | ||
(:import (clojure.lang Keyword Symbol))) | ||
|
||
(t/ann kw-invoke [Keyword -> (U nil Number)]) | ||
(defn kw-invoke [k] | ||
(k {:a 1 :b 2})) | ||
|
||
(t/ann sym-invoke [Symbol -> (U nil Number)]) | ||
(defn sym-invoke [k] | ||
(k {:a 1 :b 2})) | ||
|
||
(t/ann either-invoke [(U Keyword Symbol) -> (U nil Number)]) | ||
(defn either-invoke [k] | ||
(k {:a 1 :b 2})) |