From 6df2e0b54d55380618283fcf3aafd716dcfec755 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sun, 18 May 2014 11:51:33 -0700 Subject: [PATCH] Make subst-gen not duplicate call to values. original commit: 7e7350691fde793b5ec751f271388b176107c3eb --- .../typed-racket/infer/infer-unit.rkt | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt index a150d1d5..e977fd51 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt @@ -752,31 +752,30 @@ (match (car (cset-maps C)) [(cons cmap (dmap dm)) (let ([subst (hash-union - (for/hash ([(k dc) (in-hash dm)]) - (match dc - [(dcon fixed #f) - (values k - (i-subst - (for/list ([f fixed]) - (constraint->type f idx-hash #:variable k))))] - [(dcon fixed rest) - (values k - (i-subst/starred (for/list ([f (in-list fixed)]) - (constraint->type f idx-hash #:variable k)) - (constraint->type rest idx-hash)))] - [(dcon-exact fixed rest) - (values k - (i-subst/starred - (for/list ([f (in-list fixed)]) - (constraint->type f idx-hash #:variable k)) - (constraint->type rest idx-hash)))] - [(dcon-dotted fixed dc dbound) - (values k - (i-subst/dotted - (for/list ([f (in-list fixed)]) - (constraint->type f idx-hash #:variable k)) - (constraint->type dc idx-hash #:variable k) - dbound))])) + (for/hash ([(k dc) (in-hash dm)]) + (values + k + (match dc + [(dcon fixed #f) + (i-subst + (for/list ([f fixed]) + (constraint->type f idx-hash #:variable k)))] + [(dcon fixed rest) + (i-subst/starred + (for/list ([f (in-list fixed)]) + (constraint->type f idx-hash #:variable k)) + (constraint->type rest idx-hash))] + [(dcon-exact fixed rest) + (i-subst/starred + (for/list ([f (in-list fixed)]) + (constraint->type f idx-hash #:variable k)) + (constraint->type rest idx-hash))] + [(dcon-dotted fixed dc dbound) + (i-subst/dotted + (for/list ([f (in-list fixed)]) + (constraint->type f idx-hash #:variable k)) + (constraint->type dc idx-hash #:variable k) + dbound)]))) (for/hash ([(k v) (in-hash cmap)]) (values k (t-subst (constraint->type v var-hash)))))]) ;; verify that we got all the important variables