[commit: ghc] master: Don't tidy vars when dumping a type (ef39af7)
git at git.haskell.org
git at git.haskell.org
Thu Jul 27 11:49:42 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/ef39af721a9002dda5c7ea5a781d7747792f1d5f/ghc
>---------------------------------------------------------------
commit ef39af721a9002dda5c7ea5a781d7747792f1d5f
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date: Fri Apr 7 11:13:32 2017 -0400
Don't tidy vars when dumping a type
This makes variables print more consistenty in, say,
-ddump-tc-trace.
>---------------------------------------------------------------
ef39af721a9002dda5c7ea5a781d7747792f1d5f
compiler/types/TyCoRep.hs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index f5d3374..9b82ab8 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -137,8 +137,8 @@ import {-# SOURCE #-} DataCon( dataConFullSig
, dataConUnivTyVarBinders, dataConExTyVarBinders
, DataCon, filterEqSpec )
import {-# SOURCE #-} Type( isPredTy, isCoercionTy, mkAppTy, mkCastTy
- , tyCoVarsOfTypesWellScoped
, tyCoVarsOfTypeWellScoped
+ , tyCoVarsOfTypesWellScoped
, coreView, typeKind )
-- Transitively pulls in a LOT of stuff, better to break the loop
@@ -2445,7 +2445,7 @@ pprType = pprPrecType TopPrec
pprParendType = pprPrecType TyConPrec
pprPrecType :: TyPrec -> Type -> SDoc
-pprPrecType prec ty = pprPrecIfaceType prec (tidyToIfaceType ty)
+pprPrecType prec ty = getPprStyle $ \sty -> pprPrecIfaceType prec (tidyToIfaceTypeSty ty sty)
pprTyLit :: TyLit -> SDoc
pprTyLit = pprIfaceTyLit . toIfaceTyLit
@@ -2454,6 +2454,12 @@ pprKind, pprParendKind :: Kind -> SDoc
pprKind = pprType
pprParendKind = pprParendType
+tidyToIfaceTypeSty :: Type -> PprStyle -> IfaceType
+tidyToIfaceTypeSty ty sty
+ | userStyle sty = tidyToIfaceType ty
+ | otherwise = toIfaceTypeX (tyCoVarsOfType ty) ty
+ -- in latter case, don't tidy, as we'll be printing uniques.
+
tidyToIfaceType :: Type -> IfaceType
-- It's vital to tidy before converting to an IfaceType
-- or nested binders will become indistinguishable!
More information about the ghc-commits
mailing list