diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-07 13:48:30 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-07 15:10:22 +0100 |
commit | 547c597112954353cef7157cb0a389bc4f6303eb (patch) | |
tree | 912147211c3047ce96aebc2bb357c789971f56d5 /compiler/utils/Outputable.hs | |
parent | 9f0f99fd41ff82cc223d3b682703e508efb564d2 (diff) | |
download | haskell-547c597112954353cef7157cb0a389bc4f6303eb.tar.gz |
Reduce module qualifiers in pretty-printing
The change is in HscTypes.mkPrintUnqualified, and suppresses the
module qualifier on Names from ghc-prim, base, and template-haskell,
where no ambiguity can aries. It's somewhat arbitrary, but helps
with things like 'Constraint' which are often not in scope, but
occasionally show up in error messages.
Diffstat (limited to 'compiler/utils/Outputable.hs')
-rw-r--r-- | compiler/utils/Outputable.hs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index e6e8e02dda..36ac6271be 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -173,15 +173,17 @@ type QueryQualifyModule = Module -> Bool type QueryQualifyPackage = PackageKey -> Bool -- See Note [Printing original names] in HscTypes -data QualifyName -- given P:M.T - = NameUnqual -- refer to it as "T" - | NameQual ModuleName -- refer to it as "X.T" for the supplied X - | NameNotInScope1 - -- it is not in scope at all, but M.T is not bound in the current - -- scope, so we can refer to it as "M.T" - | NameNotInScope2 - -- it is not in scope at all, and M.T is already bound in the - -- current scope, so we must refer to it as "P:M.T" +data QualifyName -- Given P:M.T + = NameUnqual -- It's in scope unqualified as "T" + -- OR nothing called "T" is in scope + + | NameQual ModuleName -- It's in scope qualified as "X.T" + + | NameNotInScope1 -- It's not in scope at all, but M.T is not bound + -- in the current scope, so we can refer to it as "M.T" + + | NameNotInScope2 -- It's not in scope at all, and M.T is already bound in + -- the current scope, so we must refer to it as "P:M.T" reallyAlwaysQualifyNames :: QueryQualifyName reallyAlwaysQualifyNames _ _ = NameNotInScope2 |