From 31175885baab218934c8faddb0e067e6f7616318 Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 11 Oct 2002 07:22:05 +0000 Subject: [PATCH] [project @ 2002-10-11 07:22:05 by simonpj] Fix two separate egregious errors in RdrHsSyn, which I heavily modified when re-doing the top level plumbing. One had the effect of throwing away fixity decls if there was also a class decl The other threw away all but the first and last equation of a function definition. Sorry about having so utterly broken the head, guys. --- ghc/compiler/parser/RdrHsSyn.lhs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ghc/compiler/parser/RdrHsSyn.lhs b/ghc/compiler/parser/RdrHsSyn.lhs index 756dfc1..4ef778a 100644 --- a/ghc/compiler/parser/RdrHsSyn.lhs +++ b/ghc/compiler/parser/RdrHsSyn.lhs @@ -391,15 +391,15 @@ getMonoBind :: RdrNameMonoBinds -> [RdrBinding] -> (RdrNameMonoBinds, [RdrBindin -- -- No AndMonoBinds or EmptyMonoBinds here; just single equations -getMonoBind (FunMonoBind f1 inf1 mtchs1 loc1) binds - | has_args mtchs1 - = go mtchs1 loc1 binds +getMonoBind (FunMonoBind f inf mtchs loc) binds + | has_args mtchs + = go mtchs loc binds where - go mtchs loc (RdrValBinding (FunMonoBind f2 inf2 mtchs2 loc2) : binds) - | f1 == f2 = go (mtchs2 ++ mtchs1) loc2 binds + go mtchs1 loc1 (RdrValBinding (FunMonoBind f2 inf2 mtchs2 loc2) : binds) + | f == f2 = go (mtchs2 ++ mtchs1) loc2 binds -- Remember binds is reversed, so glue mtchs2 on the front -- and use loc2 as the final location - go mtchs loc binds = (FunMonoBind f1 inf1 mtchs loc, binds) + go mtchs1 loc1 binds = (FunMonoBind f inf mtchs1 loc1, binds) getMonoBind bind binds = (bind, binds) @@ -440,7 +440,7 @@ add gp (SpliceD e : ds) = (gp, Just (e, ds)) -- Class declarations: pull out the fixity signatures to the top add gp@(HsGroup {hs_tyclds = ts, hs_fixds = fs}) (TyClD d : ds) | isClassDecl d = add (gp { hs_tyclds = d : ts, - hs_fixds = [f | FixSig f <- tcdSigs d] }) ds + hs_fixds = [f | FixSig f <- tcdSigs d] ++ fs }) ds | otherwise = add (gp { hs_tyclds = d : ts }) ds -- Signatures: fixity sigs go a different place than all others -- 1.7.10.4