Commit d464e73b authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Use parenSymOcc when displaying an export list in RnNames (fixes Trac #5385)

I also called parenSymOcc in two other places that begged for it.
parent 8ceb988d
......@@ -1609,18 +1609,20 @@ badImportItemErrDataCon dataType iface decl_spec ie
<+> ptext (sLit "is a data constructor of")
<+> quotes (ppr dataType)
, ptext (sLit "To import it use")
, nest 2 $ quotes (ptext (sLit "import")
, nest 2 $ quotes (ptext (sLit "import"))
<+> ppr (is_mod decl_spec)
<+> parens (ppr dataType <+> parens datacon))
<> parens_sp (ppr dataType <> parens_sp datacon)
, ptext (sLit "or")
, nest 2 $ quotes (ptext (sLit "import")
, nest 2 $ quotes (ptext (sLit "import"))
<+> ppr (is_mod decl_spec)
<+> parens (ppr dataType <+> parens (ptext $ sLit "..")))
<> parens_sp (ppr dataType <> ptext (sLit "(..)"))
]
where
datacon = ppr . rdrNameOcc $ ieName ie
datacon_occ = rdrNameOcc $ ieName ie
datacon = parenSymOcc datacon_occ (ppr datacon_occ)
source_import | mi_boot iface = ptext (sLit "(hi-boot interface)")
| otherwise = empty
parens_sp d = parens (space <> d <> space) -- T( f,g )
badImportItemErr :: ModIface -> ImpDeclSpec -> IE RdrName -> [AvailInfo] -> SDoc
badImportItemErr iface decl_spec ie avails
......
......@@ -92,7 +92,7 @@ import VarEnv
import VarSet
import Maybes ( orElse )
import Name ( Name, NamedThing(..), nameUnique )
import OccName ( isSymOcc )
import OccName ( parenSymOcc )
import Util
import BasicTypes
import Outputable
......@@ -367,9 +367,7 @@ ppr_co p (AppCo co1 co2) = maybeParen p TyConPrec $
ppr_co p co@(ForAllCo {}) = ppr_forall_co p co
ppr_co _ (CoVarCo cv)
| isSymOcc (getOccName cv) = parens (ppr cv)
| otherwise = ppr cv
ppr_co _ (CoVarCo cv) = parenSymOcc (getOccName cv) (ppr cv)
ppr_co p (AxiomInstCo con cos) = pprTypeNameApp p ppr_co (getName con) cos
......
......@@ -597,8 +597,7 @@ ppr_forall_type p ty
ppr_tvar :: TyVar -> SDoc
ppr_tvar tv -- Note [Infix type variables]
| isSymOcc (getOccName tv) = parens (ppr tv)
| otherwise = ppr tv
= parenSymOcc (getOccName tv) (ppr tv)
-------------------
pprForAll :: [TyVar] -> SDoc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment