[MLton-commit] r6525

Matthew Fluet fluet at mlton.org
Thu Apr 3 06:28:04 PST 2008


Minor refactoring of SSA IL type checking.

Check datatype constructor types after putting all tycon and con
identifiers in scope.  This isn't functionally different (as con
identifiers cannot appear in types), but better aligns with the
necessary checks for the SSA2 IL.

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

U   mlton/trunk/mlton/ssa/type-check.fun

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

Modified: mlton/trunk/mlton/ssa/type-check.fun
===================================================================
--- mlton/trunk/mlton/ssa/type-check.fun	2008-04-03 14:28:00 UTC (rev 6524)
+++ mlton/trunk/mlton/ssa/type-check.fun	2008-04-03 14:28:03 UTC (rev 6525)
@@ -80,8 +80,7 @@
               ()
            end))
       fun loopTypes tys = Vector.foreach (tys, loopType)
-      (* Redefine bindCon and bindVar to check well-formedness of types. *)
-      val bindCon = fn (con, args, i) => (loopTypes args; bindCon (con, i))
+      (* Redefine bindVar to check well-formedness of types. *)
       val bindVar = fn (x, ty) => (loopType ty; bindVar (x, ty))
       fun loopExp exp = 
          let
@@ -213,10 +212,13 @@
          end
       val _ = Vector.foreach
               (datatypes, fn Datatype.T {tycon, cons} =>
-               bindTycon (tycon, Vector.length cons))
+               (bindTycon (tycon, Vector.length cons)
+                ; Vector.foreachi (cons, fn (i, {con, ...}) => 
+                                   bindCon (con, i))))
       val _ = Vector.foreach
               (datatypes, fn Datatype.T {cons, ...} =>
-               Vector.foreachi (cons, fn (i, {con, args, ...}) => bindCon (con, args, i)))
+               Vector.foreach (cons, fn {args, ...} => 
+                               Vector.foreach (args, loopType)))
       val _ = Vector.foreach (globals, loopStatement)
       val _ = List.foreach (functions, bindFunc o Function.name)
       val _ = getFunc main




More information about the MLton-commit mailing list