
Hi, 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. I got following error: ==================================== Error when renaming:: Unbound Identifier a0 at 4:44 ... (lots of internal compiler state lines) under NHC 1.02 cygwin (win2k), although I think the program that caused this is correct. The program consists of 2 small files: File Test1.hs: --- module Test1(fn) where import Test2 fn :: Test -> Int fn t@(Test { a0 = a } ) = a0 t + a --- File Test2.hs: --- module Test2(Test(..)) where data Test = Test { a0 :: Int, b0 :: Int } -- I compiled Test2.hs with "nhc98 -c Test2.hs" and then tried to compile Test1.hs and got this error. Best regards, Mark

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 ++
participants (2)
-
Malcolm Wallace
-
Mark Tehver