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