bug (?) in type checking of record update

Ross Paterson ross@soi.city.ac.uk
Tue, 4 Feb 2003 10:35:27 +0000


On Tue, Feb 04, 2003 at 10:14:19AM +0000, Ross Paterson wrote:
> On Tue, Feb 04, 2003 at 11:00:16AM +0100, Johannes Waldmann wrote:
> > data Container a = 
> >      Container   { contents :: a
> > 		 , info :: String
> > 		 } 
> 
> Definitely a bug in typing of record updates:
> 
> Bug> :t Container { contents = True , info = "foo" } { info = "bar" }
> Container{contents = True, info = "foo"}{info = "bar"} :: Container a

This was introduced in the last release.  Here's a patch that reverses it,
but presumably something more refined is needed to achieve the original aim:

Index: src/type.c
===================================================================
RCS file: /home/cvs/root/hugs98/src/type.c,v
retrieving revision 1.62
diff -u -r1.62 type.c
--- src/type.c	23 Jan 2003 17:47:08 -0000	1.62
+++ src/type.c	4 Feb 2003 10:28:08 -0000
@@ -1814,11 +1814,8 @@
 		instantiate(t);
 		shouldBe(line,snd(f),e,update,arg(fun(tr)),or);
 	    }					/* Unmentioned component   */
-	    /* this is just a sanity check, and avoiding it lets us
-	       handle records with polymoprhic components
 	    else if (!unify(arg(fun(td)),od,arg(fun(tr)),or))
 		internal("typeUpdFlds");
-	    */
 
 	    tr = arg(tr);
 	    td = arg(td);