[MLton-commit] r6189

Matthew Fluet fluet at mlton.org
Tue Nov 20 15:25:51 PST 2007


Regression demonstrating bug with weaks and deepFlatten
----------------------------------------------------------------------

A   mlton/trunk/regression/weak.2.ok
A   mlton/trunk/regression/weak.2.sml

----------------------------------------------------------------------

Added: mlton/trunk/regression/weak.2.ok
===================================================================
--- mlton/trunk/regression/weak.2.ok	2007-11-20 09:41:03 UTC (rev 6188)
+++ mlton/trunk/regression/weak.2.ok	2007-11-20 23:25:50 UTC (rev 6189)
@@ -0,0 +1 @@
+true

Added: mlton/trunk/regression/weak.2.sml
===================================================================
--- mlton/trunk/regression/weak.2.sml	2007-11-20 09:41:03 UTC (rev 6188)
+++ mlton/trunk/regression/weak.2.sml	2007-11-20 23:25:50 UTC (rev 6189)
@@ -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
+*)
\ No newline at end of file




More information about the MLton-commit mailing list