Bug explanation.

This commit is contained in:
Erik Svedäng 2020-05-04 15:09:44 +02:00
parent 3e98719ec2
commit e288381a6d

View File

@ -146,7 +146,20 @@
;; (set! x 11)
;; (println* x))))
;; The ref error is detected when the forms inside (= ...) are reversed.
;; Right now the lifetime (that is shared by both arguments to =) becomes
;; set to [111], which is alive for the rest of the scope.
;; So the memory error inside (let ...) doesn't get detected since the
;; lifetime is alive before, during, and after its scope.
(defn f []
(= $[1 2 4]
(let [xs $[1 2 3]]
xs)))
(=
&[111]
(let [xs &[222]]
xs)
))