Fix TR error for missing mandatory keywords
original commit: c7162ec533ece42d3ece961f30a1c4ba2f8f4b3b
This commit is contained in:
parent
f7d1cab2bb
commit
300d3dae51
11
collects/tests/typed-racket/fail/mandatory-kw.rkt
Normal file
11
collects/tests/typed-racket/fail/mandatory-kw.rkt
Normal 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)
|
|
@ -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) _)
|
||||
|
|
Loading…
Reference in New Issue
Block a user