Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix CTYP-74

Better error with malformed TApp
  • Loading branch information...
commit edeb6cf572c48792a4bf0f025001e4f35a7bfb70 1 parent 20b1682
Ambrose Bonnaire-Sergeant authored October 06, 2013
5  src/main/clojure/clojure/core/typed/parse_unparse.clj
@@ -519,7 +519,10 @@
519 519
 
520 520
 (defmethod parse-type-list :default 
521 521
   [[n & args :as syn]]
522  
-  (r/TApp-maker (parse-type n) (mapv parse-type args)))
  522
+  (let [op (parse-type n)]
  523
+    (when-not ((some-fn r/Name? r/TypeFn? r/F? r/B? r/Poly?) op)
  524
+      (u/int-error (str "Invalid operator to TApp: " (pr-str (unparse-type op)))))
  525
+    (r/TApp-maker op (mapv parse-type args))))
523 526
 
524 527
 (defmethod parse-type Cons [l] (parse-type-list l))
525 528
 (defmethod parse-type IPersistentList [l] (parse-type-list l))
3  src/test/clojure/clojure/core/typed/test/core.clj
@@ -2354,6 +2354,9 @@
2354 2354
 (deftest CTYP-78-finally-expected-test
2355 2355
   (is (check-ns 'clojure.core.typed.test.finally)))
2356 2356
 
  2357
+(deftest CTYP-74-malformed-TApp-test
  2358
+  (is (u/tc-error-thrown? (parse-type '([Any -> Any])))))
  2359
+
2357 2360
 ;(reset-caches)
2358 2361
 
2359 2362
 ;(chk/abstract-result

0 notes on commit edeb6cf

Please sign in to comment.
Something went wrong with that request. Please try again.