[MLton-commit] r6216

Matthew Fluet fluet at mlton.org
Tue Nov 27 13:34:02 PST 2007


Regression test demonstrating internal compiler error with flexible records
----------------------------------------------------------------------

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

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

Added: mlton/trunk/regression/flexrecord.2.ok
===================================================================

Added: mlton/trunk/regression/flexrecord.2.sml
===================================================================
--- mlton/trunk/regression/flexrecord.2.sml	2007-11-27 14:43:39 UTC (rev 6215)
+++ mlton/trunk/regression/flexrecord.2.sml	2007-11-27 21:34:01 UTC (rev 6216)
@@ -0,0 +1,27 @@
+datatype b = TRUE | FALSE
+   
+datatype nat = Z | S of nat
+   
+fun lt (Z, S _) = TRUE
+  | lt (S n1, S n2) = lt (n1, n2)
+  | lt _ = FALSE
+   
+fun ZZZ_f (a, b) = lt (#value a, #value b)
+   
+fun ZZZ_copyTo (array, record as {value, offset}) =
+   fn S Z => {value = value, offset = S (S (S Z))}
+    | n => array n
+
+fun ZZZ_fixTooBig (array, record) =
+   let
+      val left = array (S Z)
+      val right = array (S (S Z))
+      val small = 
+         case ZZZ_f (left, right) of 
+            TRUE => left 
+          | FALSE => right
+   in
+      case ZZZ_f (record, small) of
+         TRUE => ZZZ_copyTo (array, record)
+       | FALSE => ZZZ_copyTo (array, small)
+   end




More information about the MLton-commit mailing list