Created
April 12, 2014 15:55
-
-
Save frenchy64/10542732 to your computer and use it in GitHub Desktop.
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
(ns clojure.core.typed.test.unsound-record | |
(:require [clojure.core.typed :as t])) | |
(t/ann-record Foo [a :- Number]) | |
(defrecord Foo [a]) | |
(t/ann unsound [(t/Map Any Any) -> Number]) | |
(defn unsound [r] | |
(let [r (assoc r :a nil)] | |
(assert (instance? Foo r)) | |
(inc (:a r)))) | |
; NPE at runtime | |
(fn [] | |
(unsound (->Foo 1))) | |
; check-ns | |
; ... | |
; :ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment