cs & schemify: another set! repair

When the mutability decision on a variable is delayed, but then the
variable is discovered to be mutable before the delay is triggered,
then mutability information could get lost.
This commit is contained in:
Matthew Flatt 2020-10-21 09:37:40 -06:00
parent 42a9e26ee9
commit efbb431a69
3 changed files with 29 additions and 4 deletions

View File

@ -3397,4 +3397,21 @@ case of module-leve bindings; it doesn't cover local bindings.
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(module regression-test-for-delayed-set!-after-direct-use racket/base
(define align
(lambda ()
'ok))
(define strings-are-numbers
(let-values ([(real-align) align])
(lambda ()
(set! align 7)
real-align)))
(void (strings-are-numbers)))
(dynamic-require ''regression-test-for-delayed-set!-after-direct-use #f)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -19213,9 +19213,16 @@
ids_0
(lambda ()
(begin
(hash-remove!
mutated_0
v_1)
(if (eq?
(hash-ref
mutated_0
v_1
#f)
state_0)
(hash-remove!
mutated_0
v_1)
(void))
(|#%app|
state_0))))
(begin

View File

@ -221,7 +221,8 @@
[ids
;; Chain delays
(delay! ids (lambda ()
(hash-remove! mutated v)
(when (eq? (hash-ref mutated v #f) state)
(hash-remove! mutated v))
(state)))]
[else
(hash-remove! mutated v)