Make -id-path handle mutable variables correctly.

This commit is contained in:
Eric Dobson 2014-06-25 23:15:17 -07:00
parent e9899a07a6
commit 6b69c396f4
2 changed files with 8 additions and 6 deletions

View File

@ -43,7 +43,7 @@
(ret ty (ret ty
(make-FilterSet (-not-filter (-val #f) id) (make-FilterSet (-not-filter (-val #f) id)
(-filter (-val #f) id)) (-filter (-val #f) id))
(make-Path null id)))) (-id-path id))))
;; typecheck an expression, but throw away the effect ;; typecheck an expression, but throw away the effect
;; tc-expr/t : Expr -> Type ;; tc-expr/t : Expr -> Type

View File

@ -119,7 +119,9 @@
(define/decl -no-obj (make-NoObject)) (define/decl -no-obj (make-NoObject))
(define/decl -empty-obj (make-Empty)) (define/decl -empty-obj (make-Empty))
(define (-id-path id) (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]) (define (-arg-path arg [depth 0])
(make-Path null (list depth arg))) (make-Path null (list depth arg)))
(define (-acc-path path-elems o) (define (-acc-path path-elems o)
@ -140,9 +142,9 @@
(cond (cond
[(Object? i) i] [(Object? i) i]
[(integer? i) (make-Path null (list 0 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 (cond
[(and (identifier? i) (is-var-mutated? i)) -top]
[(Empty? o) -top] [(Empty? o) -top]
[(equal? Univ t) -top] [(equal? Univ t) -top]
[(equal? -Bottom t) -bot] [(equal? -Bottom t) -bot]
@ -158,9 +160,9 @@
(cond (cond
[(Object? i) i] [(Object? i) i]
[(integer? i) (make-Path null (list 0 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 (cond
[(and (identifier? i) (is-var-mutated? i)) -top]
[(Empty? o) -top] [(Empty? o) -top]
[(equal? -Bottom t) -top] [(equal? -Bottom t) -top]
[(equal? Univ t) -bot] [(equal? Univ t) -bot]