racket / ChezScheme

Chez Scheme
Apache License 2.0
110 stars 8 forks source link

cp0 incorrectly handles assigned variables #39

Closed burgerrg closed 3 years ago

burgerrg commented 3 years ago
(library (trouble)
  (export make-param)
  (import (scheme))
  (define (make-param initial)
    (let ([v initial])
      (case-lambda
       [() v]
       [(x) (set! v x)]))))

After importing this library, run (expand/optimize '(make-param #f)) and see that v was incorrectly replaced with#f.

mflatt commented 3 years ago

Thanks for the report!

burgerrg commented 3 years ago

Thanks for finding and fixing it so quickly!