summaryrefslogtreecommitdiff
path: root/compiler/main/PprTyThing.hs
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2007-09-10 10:38:30 +0000
committerSimon Marlow <simonmar@microsoft.com>2007-09-10 10:38:30 +0000
commit3b1438a9757639d7f37f10e1237e2369ca0ebe4a (patch)
treef06e4469a71c3158c1d895d574284e20ff7f1d88 /compiler/main/PprTyThing.hs
parent37df27c6f21452c60c45b5cf6defc9003a41da15 (diff)
downloadhaskell-3b1438a9757639d7f37f10e1237e2369ca0ebe4a.tar.gz
FIX #903: mkWWcpr: not a product
This fixes the long-standing bug that prevents some code with mutally-recursive modules from being compiled with --make and -O, including GHC itself. See the comments for details. There are some additional cleanups that were forced/enabled by this patch: I removed importedSrcLoc/importedSrcSpan: it wasn't adding any useful information, since a Name already contains its defining Module. In fact when re-typechecking an interface file we were wrongly replacing the interesting SrcSpans in the Names with boring importedSrcSpans, which meant that location information could degrade after reloading modules. Also, recreating all these Names was a waste of space/time.
Diffstat (limited to 'compiler/main/PprTyThing.hs')
-rw-r--r--compiler/main/PprTyThing.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/main/PprTyThing.hs b/compiler/main/PprTyThing.hs
index a0bad30fd0..d58bd11092 100644
--- a/compiler/main/PprTyThing.hs
+++ b/compiler/main/PprTyThing.hs
@@ -30,6 +30,7 @@ import TyCon ( tyConFamInst_maybe )
import Type ( pprTypeApp )
import GHC ( TyThing(..), SrcSpan )
import Var
+import Name
import Outputable
-- -----------------------------------------------------------------------------
@@ -44,7 +45,7 @@ type PrintExplicitForalls = Bool
pprTyThingLoc :: PrintExplicitForalls -> TyThing -> SDoc
pprTyThingLoc pefas tyThing
= showWithLoc loc (pprTyThing pefas tyThing)
- where loc = GHC.nameSrcSpan (GHC.getName tyThing)
+ where loc = pprNameLoc (GHC.getName tyThing)
-- | Pretty-prints a 'TyThing'.
pprTyThing :: PrintExplicitForalls -> TyThing -> SDoc
@@ -57,7 +58,7 @@ pprTyThing pefas (AClass cls) = pprClass pefas cls
pprTyThingInContextLoc :: PrintExplicitForalls -> TyThing -> SDoc
pprTyThingInContextLoc pefas tyThing
= showWithLoc loc (pprTyThingInContext pefas tyThing)
- where loc = GHC.nameSrcSpan (GHC.getName tyThing)
+ where loc = pprNameLoc (GHC.getName tyThing)
-- | Pretty-prints a 'TyThing' in context: that is, if the entity
-- is a data constructor, record selector, or class method, then
@@ -241,9 +242,9 @@ add_bars (c:cs) = sep ((equals <+> c) : map (char '|' <+>) cs)
ppr_bndr :: GHC.NamedThing a => a -> SDoc
ppr_bndr a = GHC.pprParenSymName a
-showWithLoc :: SrcSpan -> SDoc -> SDoc
+showWithLoc :: SDoc -> SDoc -> SDoc
showWithLoc loc doc
- = hang doc 2 (char '\t' <> comment <+> GHC.pprDefnLoc loc)
+ = hang doc 2 (char '\t' <> comment <+> loc)
-- The tab tries to make them line up a bit
where
comment = ptext SLIT("--")