From 1d6678c2ad6dc656f743d97afd4d798f39a13b18 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Fri, 10 Aug 2012 10:27:18 -0400 Subject: [PATCH] Don't generate rest specification for ->* when not needed. original commit: aa6ed4d736b2e4486c82a4a1ed4ac7b1f9296a3e --- collects/typed-racket/private/type-contract.rkt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/collects/typed-racket/private/type-contract.rkt b/collects/typed-racket/private/type-contract.rkt index b66d0818..59e9ca03 100644 --- a/collects/typed-racket/private/type-contract.rkt +++ b/collects/typed-racket/private/type-contract.rkt @@ -88,20 +88,21 @@ (and rst (t->c/neg rst))) (exit (fail)))] [_ (exit (fail))])) - (with-syntax + (with-syntax* ([(dom* ...) (if method? (cons #'any/c dom*) dom*)] [(opt-dom* ...) opt-dom*] [rng* (match rngs* [(list r) r] [_ #`(values #,@rngs*)])] - [rst* rst]) + [rst* rst] + [(rst-spec ...) (if rst #'(#:rest (listof rst*)) #'())]) ;; Garr, I hate case->! (if (and (pair? (syntax-e #'(opt-dom* ...))) case->) (exit (fail)) (if (or rst (pair? (syntax-e #'(opt-dom* ...)))) (if case-> - #'(dom* ... #:rest (listof rst*) . -> . rng*) - #'((dom* ...) (opt-dom* ...) #:rest (listof rst*) . ->* . rng*)) + #'(dom* ... rst-spec ... . -> . rng*) + #'((dom* ...) (opt-dom* ...) rst-spec ... . ->* . rng*)) #'(dom* ... . -> . rng*))))) (unless (no-duplicates (for/list ([t arrs]) (match t