[MLton-devel] cvs commit: bugfix: empty tyavrs in PolyVal dec

Stephen Weeks sweeks@users.sourceforge.net
Mon, 14 Jul 2003 13:42:17 -0700


sweeks      03/07/14 13:42:17

  Modified:    doc      changelog
               mlton/xml type-check.fun
  Log:
  Fixed bug reported by Joao (joaoraf@solar.com.br) that caused error
  message:
  
  	empty tyvars in PolyVal dec
  
  The problem was that the XML type checker made sure that a PolyVal dec
  always had at least one tyvar.  This made some sense, since if there
  weren't any tyvars, why not use a MonoVal dec.  Unfortunately, the
  relatively new xml/simplify-types pass can eliminate all of the tyvars
  in a PolyVal dec, thus violating the invariant.  I could have tried to
  have that pass rewrite such PolyVal decs to MonoVal decs, but that's
  not trivial, since they bind different kinds of expressions.  So, the
  easiest thing to do is for the XML type checker to allow empty tyvars
  in PolyVal decs.  No other pass seemed to rely on this property.

Revision  Changes    Path
1.57      +2 -0      mlton/doc/changelog

Index: changelog
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/changelog,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- changelog	14 Jul 2003 19:15:10 -0000	1.56
+++ changelog	14 Jul 2003 20:42:17 -0000	1.57
@@ -4,6 +4,8 @@
   - Fixed packaging for Cygwin and Sparc to include libgmp.a.
   - Eliminated bootstrap target.  The Makefile automatically
     determines whether to bootstrap or not.
+  - Fixed XML type checker bug that could cause error: empty tyvars in
+    PolyVal dec.
 
 * 2003-07-12
   - Turned off FORCE_GENERATIONAL in gc.  It had been set, which



1.13      +3 -6      mlton/mlton/xml/type-check.fun

Index: type-check.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/xml/type-check.fun,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- type-check.fun	23 Jun 2003 04:59:00 -0000	1.12
+++ type-check.fun	14 Jul 2003 20:42:17 -0000	1.13
@@ -275,12 +275,9 @@
 	     | PolyVal {tyvars, var, ty, exp} =>
 		  (bindTyvars tyvars
 		   ; checkType ty
-		   ; if Vector.isEmpty tyvars
-			then Error.bug "empty tyvars in PolyVal dec"
-		     else ()
-			; check (ty, checkExp exp)
-			; unbindTyvars tyvars
-			; setVar (var, {tyvars = tyvars, ty = ty}))
+		   ; check (ty, checkExp exp)
+		   ; unbindTyvars tyvars
+		   ; setVar (var, {tyvars = tyvars, ty = ty}))
 	     | Fun {tyvars, decs} =>
 		  (bindTyvars tyvars
 		   ; (Vector.foreach





-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel