Permalink
Browse files

Fix CTYP-74

Better error with malformed TApp
  • Loading branch information...
1 parent 20b1682 commit edeb6cf572c48792a4bf0f025001e4f35a7bfb70 @frenchy64 frenchy64 committed Oct 6, 2013
@@ -519,7 +519,10 @@
(defmethod parse-type-list :default
[[n & args :as syn]]
- (r/TApp-maker (parse-type n) (mapv parse-type args)))
+ (let [op (parse-type n)]
+ (when-not ((some-fn r/Name? r/TypeFn? r/F? r/B? r/Poly?) op)
+ (u/int-error (str "Invalid operator to TApp: " (pr-str (unparse-type op)))))
+ (r/TApp-maker op (mapv parse-type args))))
(defmethod parse-type Cons [l] (parse-type-list l))
(defmethod parse-type IPersistentList [l] (parse-type-list l))
@@ -2354,6 +2354,9 @@
(deftest CTYP-78-finally-expected-test
(is (check-ns 'clojure.core.typed.test.finally)))
+(deftest CTYP-74-malformed-TApp-test
+ (is (u/tc-error-thrown? (parse-type '([Any -> Any])))))
+
;(reset-caches)
;(chk/abstract-result

0 comments on commit edeb6cf

Please sign in to comment.