From 7633d6d1b89bbe1249b6f700d0a543d27f42a693 Mon Sep 17 00:00:00 2001 From: Andrew Kent Date: Sat, 17 Jan 2015 14:20:30 +0530 Subject: [PATCH] let/ec swapped out in update --- .../typed-racket/typecheck/tc-envops.rkt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/typed-racket-lib/typed-racket/typecheck/tc-envops.rkt b/typed-racket-lib/typed-racket/typecheck/tc-envops.rkt index 6b2e9649..852aca16 100644 --- a/typed-racket-lib/typed-racket/typecheck/tc-envops.rkt +++ b/typed-racket-lib/typed-racket/typecheck/tc-envops.rkt @@ -46,16 +46,15 @@ ;; a polymorphic field. Because subtyping is nominal and accessor ;; functions do not reflect this, this behavior is unobservable ;; except when an a variable aliases the field in a let binding - (let/ec abort - (make-Struct nm par - (list-update flds idx (match-lambda - [(fld: e acc-id #f) - (let ([ft* (update e ft pos? rst)]) - (if (Bottom? ft*) - (abort ft*) - (make-fld ft* acc-id #f)))] - [_ (int-err "update on mutable struct field")])) - proc poly pred))] + (let*-values ([(lhs rhs) (split-at flds idx)] + [(ty* acc-id) (match rhs + [(cons (fld: ty acc-id #f) _) + (values (update ty ft pos? rst) acc-id)] + [_ (int-err "update on mutable struct field")])]) + (cond + [(Bottom? ty*) ty*] + [else (let ([flds* (append lhs (cons (make-fld ty* acc-id #f) (cdr rhs)))]) + (make-Struct nm par flds* proc poly pred))]))]] ;; otherwise [(t '())