[nhc-bugs] negate problems?
Malcolm Wallace
Malcolm.Wallace@cs.york.ac.uk
Mon, 17 Sep 2001 14:39:46 +0100
> > module Main where
>
> > main :: IO()
> > main = putStrLn $ show $ foo 1
>
> > foo :: Int -> Int
> > foo (-1) = 6
> > foo i = i
>
> Compiling it gives
>
> ====================================
> Error when renaming::
> Unbound Identifier - at 8:8
This buglet is revealed because the (-) is used only in a pattern,
not in any expression in the module. Here's a patch.
Regards,
Malcolm
Index: src/compiler98/Need.hs
===================================================================
RCS file: /usr/src/master/nhc/src/compiler98/Need.hs,v
retrieving revision 1.12
diff -u -r1.12 Need.hs
--- src/compiler98/Need.hs 2001/08/17 14:04:15 1.12
+++ src/compiler98/Need.hs 2001/09/17 13:36:07
@@ -452,8 +452,8 @@
bindPat :: Exp TokenId -> NeedLib -> NeedLib
bindPat (ExpApplication pos exps) = mapR bindPat exps
-bindPat (ExpInfixList pos (ExpVarOp _ _:pats)) = mapR bindPat pats
- -- ^ must be prefix -
+bindPat (ExpInfixList pos (ExpVarOp _ op:pats)) = -- must be prefix -
+ needTid pos Var op >>> mapR bindPat pats
bindPat (ExpInfixList pos exps) = mapR bindPat exps
bindPat (ExpVar pos tid) = bindTid Var tid
bindPat (ExpCon pos tid) = needTid pos Con tid