[MLton] front-end error message

Matthew Fluet fluet@cs.cornell.edu
Thu, 14 Apr 2005 10:03:27 -0400 (EDT)


> The Error.bug "missing flexInst" at line 1492 of elaborate/type-env.fun 
> is triggered by the following program:
> 
> structure S : sig type t val f : t -> bool end =
> struct
>    datatype t = A of {a: int} | B of {b: int}
> 
>    fun f t = 
>       case t of
> 	 A {x, ...} => x = 1
>        | B {b, ...}  => b = 0
> end

How does this look for a fix:

bash-2.05b$ cvs diff mlton/elaborate/type-env.fun
Index: mlton/elaborate/type-env.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/elaborate/type-env.fun,v
retrieving revision 1.51
diff -r1.51 type-env.fun
1486a1487
> 		       DynamicWind.withEscape (fn escape =>
1492c1493
< 				NONE => Error.bug "missing flexInst"
---
> 				NONE => escape ac (* Error.bug "missing flexInst" *)
1521c1522
< 		       end))
---
> 		       end)))

My (possibly inaccurate) reasoning is that the "missing flexInst" 
only arises when the program already has an earlier type-error, 
and it corresponds to a situation where the to-be-instantiated type has 
internal flexes that aren't actually present in the type.  So, no one will 
miss the instantiated flexes in the external type.