Fix keyword argument handling - sort of hackish.
svn: r14924
This commit is contained in:
parent
06e252b1a1
commit
c8828d0638
|
@ -83,7 +83,7 @@
|
||||||
(loop kws-rest (cdr actuals) form-rest)]
|
(loop kws-rest (cdr actuals) form-rest)]
|
||||||
[else ;; otherwise, ignore this formal param, and continue
|
[else ;; otherwise, ignore this formal param, and continue
|
||||||
(loop actual-kws actuals form-rest)])]))
|
(loop actual-kws actuals form-rest)])]))
|
||||||
(tc/funapp (car (syntax-e form)) kw-args (ret (make-Function arities)) (map tc-expr (syntax->list pos-args)) expected)]
|
(tc/funapp (car (syntax-e form)) kw-args (ret (make-Function (list (make-arr* dom rng #:rest rest)))) (map tc-expr (syntax->list pos-args)) expected)]
|
||||||
[_ (int-err "case-lambda w/ keywords not supported")]))
|
[_ (int-err "case-lambda w/ keywords not supported")]))
|
||||||
|
|
||||||
(define (type->list t)
|
(define (type->list t)
|
||||||
|
@ -590,7 +590,8 @@
|
||||||
;; syntax? syntax? arr? (listof tc-results?) (or/c #f tc-results) [boolean?] -> tc-results?
|
;; syntax? syntax? arr? (listof tc-results?) (or/c #f tc-results) [boolean?] -> tc-results?
|
||||||
(define (tc/funapp1 f-stx args-stx ftype0 argtys expected #:check [check? #t])
|
(define (tc/funapp1 f-stx args-stx ftype0 argtys expected #:check [check? #t])
|
||||||
(match* (ftype0 argtys)
|
(match* (ftype0 argtys)
|
||||||
[((arr: dom (Values: (list (Result: t-r lf-r lo-r) ...)) rest #f '())
|
;; we check that all kw args are optional
|
||||||
|
[((arr: dom (Values: (list (Result: t-r lf-r lo-r) ...)) rest #f (list (Keyword: _ _ #f) ...))
|
||||||
(list (tc-result1: t-a phi-a o-a) ...))
|
(list (tc-result1: t-a phi-a o-a) ...))
|
||||||
(when check?
|
(when check?
|
||||||
(cond [(and (not rest) (not (= (length dom) (length t-a))))
|
(cond [(and (not rest) (not (= (length dom) (length t-a))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user