Permalink
Browse files

Regression demonstrating bug with weaks and deepFlatten

SVN r6189
  • Loading branch information...
MatthewFluet committed Nov 20, 2007
1 parent dc4ee56 commit 755372a65c62517cae3784841ce0974355d35522
Showing with 25 additions and 0 deletions.
  1. +1 −0 regression/weak.2.ok
  2. +24 −0 regression/weak.2.sml
View
@@ -0,0 +1 @@
true
View
@@ -0,0 +1,24 @@
structure Weak = MLton.Weak
val x = (13, ref 5)
val wx = Weak.new x
fun isAlive () = isSome (Weak.get wx)
val _ = MLton.GC.collect ()
val _ = print (Bool.toString (isAlive ()) ^ "\n")
(*
fun sum (x : int * (int list ref vector * int * int) ref) =
#1 x +
#2 (! (#2 x)) +
#3 (! (#2 x)) +
Vector.foldr (fn (lr,s) => List.foldr (op +) s (!lr)) 0 (#1 (! (#2 x)))
val x = (13, ref (Vector.tabulate (10, fn n => ref (List.tabulate (n, fn i => i))),
4,
5))
val wx = Weak.new x
fun isAlive () = isSome (Weak.get wx)
val _ = MLton.GC.collect ()
val _ = print (Bool.toString (isAlive ()) ^ "\n")
val s1 = sum x
*)

0 comments on commit 755372a

Please sign in to comment.