Catch #:row-var parsing problems in TR

Closes PR 14434

original commit: e692edc180be26c92726dffd1a595d4db3e25560
This commit is contained in:
Asumu Takikawa 2014-04-07 14:42:37 -04:00
parent 79ba079b63
commit dc3ef29b18
2 changed files with 15 additions and 4 deletions

View File

@ -704,10 +704,20 @@
(and (attribute clause.init-rest)
(parse-type (attribute clause.init-rest))))
;; Only proceed to create a class type when the parsing
;; process isn't looking for recursive type alias references.
;; (otherwise the merging process will error)
(cond [(or (null? parent-stxs)
(cond ;; If an Error type flows into the #:row-var position, a
;; delayed error should be raised from the recursive call to
;; `parse-type` so no additional error is needed here.
[(Error? given-row-var) Err]
[(not (F? given-row-var))
(tc-error/fields "parse error in type"
#:more "expected a type variable for #:row-var"
"given" given-row-var
#:delayed? #t)
Err]
;; Only proceed to create a class type when the parsing
;; process isn't looking for recursive type alias references.
;; (otherwise the merging process will error)
[(or (null? parent-stxs)
(not (current-referenced-aliases)))
(check-function-types given-methods)

View File

@ -242,6 +242,7 @@
[FAIL (All (r #:row) (Class #:implements (Class) #:row-var r))]
[FAIL (Class #:row-var 5)]
[FAIL (Class #:row-var (list 3))]
[FAIL (Class #:row-var x)]
[FAIL (Class #:implements (Class #:row-var r) #:row-var x)]
[FAIL (Class #:implements (Class #:row-var r) #:row-var r)]
[FAIL (All (r #:row)