diff options
author | Simon Jakobi <simon.jakobi@gmail.com> | 2018-08-12 11:10:39 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2018-08-12 11:10:40 +0200 |
commit | d42eef344a71990d12f27e88cdf10ba0b2a2f34b (patch) | |
tree | c38cdb9ba3ff00e86480d92e80ecdc59d2b0de1f /compiler/iface | |
parent | 193eeee6bdbd5b2ec38e26c70e8aa79ce7bd2f99 (diff) | |
download | haskell-d42eef344a71990d12f27e88cdf10ba0b2a2f34b.tar.gz |
--show-iface: Qualify all non-local names
Summary:
In order to disambiguate names from different modules, qualify all names
that don't originate in the current module.
Also update docs for QueryQualifyName
Test Plan: validate
Reviewers: simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, thomie, carter, tdammers
GHC Trac Issues: #15269
Differential Revision: https://phabricator.haskell.org/D4852
Diffstat (limited to 'compiler/iface')
-rw-r--r-- | compiler/iface/LoadIface.hs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs index 4524402985..34ba1cbb7a 100644 --- a/compiler/iface/LoadIface.hs +++ b/compiler/iface/LoadIface.hs @@ -1047,6 +1047,15 @@ ifaceStats eps Printing interfaces * * ************************************************************************ + +Note [Name qualification with --show-iface] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In order to disambiguate between identifiers from different modules, we qualify +all names that don't originate in the current module. In order to keep visual +noise as low as possible, we keep local names unqualified. + +For some background on this choice see trac #15269. -} -- | Read binary interface, and print it out @@ -1057,8 +1066,15 @@ showIface hsc_env filename = do iface <- initTcRnIf 's' hsc_env () () $ readBinIface IgnoreHiWay TraceBinIFaceReading filename let dflags = hsc_dflags hsc_env + -- See Note [Name qualification with --show-iface] + qualifyImportedNames mod _ + | mod == mi_module iface = NameUnqual + | otherwise = NameNotInScope1 + print_unqual = QueryQualify qualifyImportedNames + neverQualifyModules + neverQualifyPackages putLogMsg dflags NoReason SevDump noSrcSpan - (defaultDumpStyle dflags) (pprModIface iface) + (mkDumpStyle dflags print_unqual) (pprModIface iface) -- Show a ModIface but don't display details; suitable for ModIfaces stored in -- the EPT. |