From d0711544383876ac24d0fc167999e9bb2e94859a Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Tue, 10 Jun 2008 12:29:53 -0400 Subject: [PATCH] Instantiate w/ dots original commit: 5c8c2d3d96f02f4f8652b3c8e6fb70803ff85881 --- collects/typed-scheme/private/type-utils.ss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/collects/typed-scheme/private/type-utils.ss b/collects/typed-scheme/private/type-utils.ss index a67bc677..ead27eea 100644 --- a/collects/typed-scheme/private/type-utils.ss +++ b/collects/typed-scheme/private/type-utils.ss @@ -6,6 +6,7 @@ "rep-utils.ss" "free-variance.ss" mzlib/plt-match + scheme/list (for-syntax scheme/base)) (provide fv fv/list @@ -88,6 +89,13 @@ (unless (= (length types) (length ns)) (int-err "instantiate-poly: wrong number of types: expected ~a, got ~a" (length ns) (length types))) (subst-all (map list ns types) body)] + [(PolyDots: (list fixed ... dotted) body) + (unless (>= (length types) (length fixed)) + (int-err "instantiate-poly: wrong number of types: expected at least ~a, got ~a" (length fixed) (length types))) + (let* ([fixed-tys (take types (length fixed))] + [rest-tys (drop types (length fixed))] + [body* (subst-all (map list fixed fixed-tys) body)]) + (substitute-dots rest-tys dotted body*))] [_ (int-err "instantiate-many: requires Poly type, got ~a" t)]))