diff options
author | simonpj@microsoft.com <unknown> | 2008-08-11 14:41:18 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2008-08-11 14:41:18 +0000 |
commit | 8b072e93c055a73eb5c495cb129ea1737b925a8d (patch) | |
tree | aa2e7cc50bc9e4edaaf8b182fb513b707f21fd1d | |
parent | 3d9d59ff6b7f41a90f1325046d3d2bd09b9450b9 (diff) | |
download | haskell-8b072e93c055a73eb5c495cb129ea1737b925a8d.tar.gz |
When suppressing uniques, don't print the separating underscore
-rw-r--r-- | compiler/basicTypes/Name.lhs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/basicTypes/Name.lhs b/compiler/basicTypes/Name.lhs index cf212aee29..cba20f5c78 100644 --- a/compiler/basicTypes/Name.lhs +++ b/compiler/basicTypes/Name.lhs @@ -77,6 +77,7 @@ import SrcLoc import Unique import Maybes import Binary +import StaticFlags import FastTypes import FastString import Outputable @@ -418,7 +419,7 @@ pprInternal sty uniq occ | codeStyle sty = pprUnique uniq | debugStyle sty = ppr_occ_name occ <> braces (hsep [pprNameSpaceBrief (occNameSpace occ), pprUnique uniq]) - | dumpStyle sty = ppr_occ_name occ <> char '_' <> pprUnique uniq + | dumpStyle sty = ppr_occ_name occ <> ppr_underscore_unique uniq -- For debug dumps, we're not necessarily dumping -- tidied code, so we need to print the uniques. | otherwise = ppr_occ_name occ -- User style @@ -427,13 +428,20 @@ pprInternal sty uniq occ pprSystem :: PprStyle -> Unique -> OccName -> SDoc pprSystem sty uniq occ | codeStyle sty = pprUnique uniq - | debugStyle sty = ppr_occ_name occ <> char '_' <> pprUnique uniq + | debugStyle sty = ppr_occ_name occ <> ppr_underscore_unique uniq <> braces (pprNameSpaceBrief (occNameSpace occ)) - | otherwise = ppr_occ_name occ <> char '_' <> pprUnique uniq + | otherwise = ppr_occ_name occ <> ppr_underscore_unique uniq -- If the tidy phase hasn't run, the OccName -- is unlikely to be informative (like 's'), -- so print the unique +ppr_underscore_unique :: Unique -> SDoc +-- Print an underscore separating the name from its unique +-- But suppress it if we aren't printing the uniques anyway +ppr_underscore_unique uniq + | opt_SuppressUniques = empty + | otherwise = char '_' <> pprUnique uniq + ppr_occ_name :: OccName -> SDoc ppr_occ_name occ = ftext (occNameFS occ) -- Don't use pprOccName; instead, just print the string of the OccName; |