[nhc-bugs] nhc98 rejects legal rebinding

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Tue, 27 May 2003 11:55:58 +0100


"Simon Marlow" <simonmar@microsoft.com> writes:

> While the behaviour might arguably be wrong, I believe it's more
> important to stick to the letter of the Haskell 98 spec, at least so
> that Haskell 98 compilers are compatible with each other.  By all means
> emit a warning in this case (GHC does if you add -fwarn-name-shadowing),
> but it shouldn't be an error.  

OK, you have persuaded me.  The bug is fixed in CVS, and here is the patch.

Regards,
    Malcolm


Index: src/compiler98/Rename.hs
===================================================================
RCS file: /home/cvs/root/nhc98/src/compiler98/Rename.hs,v
retrieving revision 1.28
diff -u -r1.28 Rename.hs
--- src/compiler98/Rename.hs	12 Nov 2002 11:56:51 -0000	1.28
+++ src/compiler98/Rename.hs	27 May 2003 10:54:53 -0000
@@ -459,12 +459,14 @@
  let decls = groupFun decls'
  in pushScope >>>
     	mapS0 (bindPat Var) pats >>>
+        pushScope >>>
     	bindDecls decls >>>
 	renameDecls decls >>>= \newdecls ->	-- do first, to get infix right
     unitS Fun =>>>
 	mapS renameExp pats =>>>
 	renameRhs rhs =>>>
         unitS newdecls >>>
+        popScope >>>
     popScope