[nhc-bugs] Renaming bug?

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Fri, 17 Aug 2001 13:45:58 +0100


Mark Tehver writes:

> I am resending the following bug report. It was first reported under NHC
> 1.02 but seems to be still present in NHC 1.06.
>
> fn t@(Test { a0 = a } ) = a0 t + a
>
> Unbound Identifier a0 at 4:44

Sorry for the delay.  When I originally looked at this bug, I thought
it was caused by nhc98's poor handling of import/export of field names.
Now that I look at the error message more closely, it is actually
somewhere else, much simpler to fix.  Thanks for re-posting the
bug report.  A patch is attached.

Regards,
    Malcolm


Index: src/compiler98/Need.hs
===================================================================
RCS file: /usr/src/master/nhc/src/compiler98/Need.hs,v
retrieving revision 1.10.2.1
diff -u -r1.10.2.1 src/compiler98/Need.hs
--- src/compiler98/Need.hs	2001/07/05 11:12:54	1.10.2.1
+++ src/compiler98/Need.hs	2001/08/17 11:28:12
@@ -446,7 +446,7 @@
 bindField :: Field TokenId -> NeedLib -> NeedLib
 
 bindField (FieldExp pos var pat) = 
-  needTid pos Field var >>> bindTid Var var >>> bindPat pat
+  needTid pos Field var >>> needTid pos Var var >>> bindPat pat
 bindField (FieldPun pos var) = needTid pos Field var >>> bindTid Var var
 --bindField (FieldPun pos var) = error ("\nAt "++ strPos pos ++ ", token: "++
 --      show var ++