Permalink
Browse files

Fix CTYP-132. Type checking doesn't blow up on unresolved reflection

  • Loading branch information...
1 parent 52e3b09 commit fa22d52d8e9855ebbaf2593ec5e848ba714b25fc @frenchy64 frenchy64 committed Apr 13, 2014
View
9 src/main/clojure/clojure/core/typed/check.clj
@@ -3698,6 +3698,15 @@
(assoc expr
expr-type result-type))))
+(add-check-method :host-interop
+ [{:keys [m-or-f] :as expr} & [expected]]
+ {:post [(-> % expr-type TCResult?)]}
+ (u/tc-delayed-error (str "Unresolved host interop: " m-or-f
+ ".\n\nHint: use *warn-on-reflection* to identify reflective calls"
+ "\n\nin: " (u/emit-form-fn expr)))
+ (assoc expr
+ expr-type (or expected (ret r/-any))))
+
(add-check-method :static-call
[expr & [expected]]
{:post [(-> % expr-type TCResult?)]}
View
3 src/test/clojure/clojure/core/typed/test/core.clj
@@ -3152,3 +3152,6 @@
(is-cf (fn [& args]
(clojure.core.typed/ann-form args
(U nil (clojure.core.typed/NonEmptySeq Any))))))
+
+(deftest fail-on-reflection-test
+ (is (u/top-level-error-thrown? (check-ns 'clojure.core.typed.test.fail.reflection))))
View
5 src/test/clojure/clojure/core/typed/test/fail/reflection.clj
@@ -0,0 +1,5 @@
+(ns clojure.core.typed.test.fail.reflection
+ (:require [clojure.core.typed :as t]))
+
+(fn [a]
+ (.missing a))

0 comments on commit fa22d52

Please sign in to comment.