From be1e28cb5df8d628a0aecf541eb6baaedc9ad9ce Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Mon, 28 Apr 2014 21:20:21 -0700 Subject: [PATCH] Simplify different cases in poly tc-apply. original commit: afb3d99dc32942be34ffafdc3c114671dcc448cc --- .../typed-racket/typecheck/tc-apply.rkt | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-apply.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-apply.rkt index 26ee7443..d058b1c6 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-apply.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-apply.rkt @@ -82,30 +82,21 @@ [range (in-list rngs)] [rest (in-list rests)] [drest (in-list drests)]) - (define (finish substitution) (do-ret (subst-all substitution range))) - (cond - ;; the actual work, when we have a * function - [(and rest - (infer vars null - (list (-Tuple* arg-tys full-tail-ty)) - (list (-Tuple* domain (make-Listof rest))) - range)) - => finish] - ;; the function has no rest argument, but provides all the necessary fixed arguments - [(and (not rest) (not drest) - (infer vars null - (list (-Tuple* arg-tys full-tail-ty)) - (list (-Tuple domain)) - range)) - => finish] - ;; ... function - [(and drest - (infer vars null - (list (-Tuple* arg-tys full-tail-ty)) - (list (-Tuple* domain (make-ListDots (car drest) (cdr drest)))) - range)) - => finish] - [else #f])) + (define (finish substitution) + (and substitution (do-ret (subst-all substitution range)))) + (finish + (infer vars null + (list (-Tuple* arg-tys full-tail-ty)) + (list (-Tuple* domain + (cond + ;; the actual work, when we have a * function + [rest (make-Listof rest)] + ;; ... function + [drest (make-ListDots (car drest) (cdr drest))] + ;; the function has no rest argument, + ;; but provides all the necessary fixed arguments + [else (-val '())]))) + range))) (failure))] [(tc-result1: (PolyDots: (and vars (list fixed-vars ... dotted-var)) (Function: (list (arr: doms rngs rests drests (list (Keyword: _ _ #f) ...)) ..1))))