Fix TR error for missing mandatory keywords

original commit: c7162ec533ece42d3ece961f30a1c4ba2f8f4b3b
This commit is contained in:
Asumu Takikawa 2012-12-05 17:07:01 -05:00
parent f7d1cab2bb
commit 300d3dae51
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,11 @@
#;
(exn:pred (lambda (e) (regexp-match? "Type Checker" e)))
#lang typed/racket
;; This should raise a type error and not an internal error
(: f (#:foo False -> False))
(define (f #:foo foo) foo)
;; bad call that's missing a mandatory keyword
(f)

View File

@ -44,6 +44,18 @@
([r (in-list results)])
(open-Result r o-a t-a)))
(ret t-r f-r o-r)))]
;; this case should only match if the function type has mandatory keywords
;; but no keywords were provided in the application
[((arr: _ _ _ _
;; at least one mandatory keyword
(app (λ (kws)
(for/or ([keyword kws])
(match keyword
[(Keyword: kw _ #t) kw]
[_ #f])))
(? values req-kw))) _)
(when check?
(tc-error "Required keyword not supplied: ~a" req-kw))]
[((arr: _ _ _ drest '()) _)
(int-err "funapp with drest args ~a ~a NYI" drest argtys)]
[((arr: _ _ _ _ kws) _)