Handle kw λs when useful annotations are missing
Closes PR 14322 original commit: 7476ca0ac067a58f606f3d49ede69e09fcbc9c58
This commit is contained in:
parent
c5e442a442
commit
533c319496
|
@ -273,10 +273,10 @@
|
|||
(match expected
|
||||
[(tc-result1: (and f (or (Function: _)
|
||||
(Poly: _ (Function: _)))))
|
||||
(tc-expr/check/type #'fun (kw-convert f #:split #t))]
|
||||
(tc-expr/check/type #'fun (kw-convert f #:split #t))
|
||||
expected]
|
||||
[(or (tc-results: _) (tc-any-results:))
|
||||
(tc-error/expr "Keyword functions must have function type, given ~a" expected)])
|
||||
expected]
|
||||
(tc-expr (remove-ascription form))])]
|
||||
;; opt function def
|
||||
[(~and (let-values ([(f) fun]) . body) opt:opt-lambda^)
|
||||
(define conv-type
|
||||
|
|
|
@ -1981,6 +1981,10 @@
|
|||
[tc-err (let () (tr:define (f #{x : Symbol} #:y y) y) (f "a" #:y 'b))
|
||||
#:msg #rx"expected: Symbol.*given: String"]
|
||||
|#
|
||||
[tc-e (tr:lambda (x #:y y) y) (->key Univ #:y Univ #t Univ)]
|
||||
[tc-e ((tr:lambda (x #:y y) y) 'a #:y 'b) Univ]
|
||||
[tc-e ((tr:lambda (x #:y y . args) y) 'a #:y 'b) Univ]
|
||||
[tc-e ((tr:lambda (x #:y [y 'y] . args) y) 'a #:y 'b) Univ]
|
||||
[tc-err (let () (tr:define (f x #:y y) (string-append x "foo")) (void))
|
||||
#:msg #rx"expected: String.*given: Any"]
|
||||
[tc-err (let () (tr:define (f x #:y y) y) (f "a"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user