From 6b69c396f40f825d194bd1253f58d6a7e5c7fd64 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Wed, 25 Jun 2014 23:15:17 -0700 Subject: [PATCH] Make -id-path handle mutable variables correctly. --- .../typed-racket/typecheck/tc-expr-unit.rkt | 2 +- .../typed-racket/types/base-abbrev.rkt | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-expr-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-expr-unit.rkt index 23e82d9072..14c038a5a2 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-expr-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-expr-unit.rkt @@ -43,7 +43,7 @@ (ret ty (make-FilterSet (-not-filter (-val #f) id) (-filter (-val #f) id)) - (make-Path null id)))) + (-id-path id)))) ;; typecheck an expression, but throw away the effect ;; tc-expr/t : Expr -> Type diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/base-abbrev.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/base-abbrev.rkt index bbd625d3ba..433f1e0430 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/base-abbrev.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/base-abbrev.rkt @@ -119,7 +119,9 @@ (define/decl -no-obj (make-NoObject)) (define/decl -empty-obj (make-Empty)) (define (-id-path id) - (make-Path null id)) + (if (is-var-mutated? id) + -empty-obj + (make-Path null id))) (define (-arg-path arg [depth 0]) (make-Path null (list depth arg))) (define (-acc-path path-elems o) @@ -140,9 +142,9 @@ (cond [(Object? i) i] [(integer? i) (make-Path null (list 0 i))] - [else (make-Path null i)])) + [(list? i) (make-Path null i)] + [else (-id-path i)])) (cond - [(and (identifier? i) (is-var-mutated? i)) -top] [(Empty? o) -top] [(equal? Univ t) -top] [(equal? -Bottom t) -bot] @@ -158,9 +160,9 @@ (cond [(Object? i) i] [(integer? i) (make-Path null (list 0 i))] - [else (make-Path null i)])) + [(list? i) (make-Path null i)] + [else (-id-path i)])) (cond - [(and (identifier? i) (is-var-mutated? i)) -top] [(Empty? o) -top] [(equal? -Bottom t) -top] [(equal? Univ t) -bot]