[m-rev.] diff: fix bug in overloading resolution

Mark Brown mark at cs.mu.OZ.AU
Mon Nov 14 16:12:52 AEDT 2005


On 14-Nov-2005, Julien Fischer <juliensf at cs.mu.OZ.AU> wrote:
> 
> On Mon, 14 Nov 2005, Mark Brown wrote:
> 
> > Hi,
> >
> > This fixes the bug recently reported by Pete Ross.  Note that the bug also
> > occurs on the 0.12 release branch, and probably also in earlier releases.
> > I'm not planning to fix the release branch, though, since:
> >
> > 	- The fix for the release branch would be significantly more
> > 	  complex: there is no constraint map to refer to, so the fix
> > 	  would involve recording in each type_assign which unifications
> > 	  were actually function calls, passing this information through
> > 	  to post_typecheck, and then using it to resolve the overloading.
> >
> > 	- In most cases a simple workaround is to module qualify any data
> > 	  constructors that would otherwise be ambiguous.
> >
> 
> Can you please mention that in the BUGS file on the 0.12 branch.

Estimated hours taken: 0.25
Branches: release

BUGS:
	Mention the bug with function symbol overloading.

Index: BUGS
===================================================================
RCS file: /home/mercury1/repository/mercury/BUGS,v
retrieving revision 1.20.2.2
diff -u -r1.20.2.2 BUGS
--- BUGS	8 Sep 2005 03:10:44 -0000	1.20.2.2
+++ BUGS	14 Nov 2005 05:09:51 -0000
@@ -196,3 +196,20 @@
 compiling with intermodule-optimization enabled.  
 
 -----------------------------------------------------------------------------
+Subject: function symbol overloading
+Date: 14 Nov 2005
+
+The compiler sometimes reports a mode error for an introduced TypeClassInfo
+variable.  This can occur if there is an overloaded function symbol which is
+defined as a data constructor and also as a function with argument and return
+types which match those of the data constructor.
+
+The problem is that the typechecker can sometimes resolve the ambiguity
+if there is an unsatisfiable typeclass constraint on the function, but in
+a later stage the same resolution is not possible.  This can lead to the
+wrong definition being selected in the later stage.
+
+A workaround is to module qualify all uses of the data constructor where
+the function definition is also visible.
+
+-----------------------------------------------------------------------------
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list