summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2011-08-02 14:06:12 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2011-08-02 14:06:12 +0100
commitbdf364e86560ddb25676c259a331b7fcd722d26d (patch)
treef6b88f20c5b5b289e8f6de7c955e5273f8dd1209 /compiler
parentb97fe60cdbb21924c25cce7ed90135314021a620 (diff)
downloadhaskell-bdf364e86560ddb25676c259a331b7fcd722d26d.tar.gz
Don't bleat about non-External names in mkUsageInfo
See Note [Internal used_names]. Fixes Trac #5362.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/iface/MkIface.lhs17
1 files changed, 14 insertions, 3 deletions
diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs
index 6681ca358a..bbd02656eb 100644
--- a/compiler/iface/MkIface.lhs
+++ b/compiler/iface/MkIface.lhs
@@ -839,7 +839,7 @@ mk_usage_info pit hsc_env this_mod direct_imports used_names
this_pkg = thisPackage dflags
used_mods = moduleEnvKeys ent_map
- dir_imp_mods = (moduleEnvKeys direct_imports)
+ dir_imp_mods = moduleEnvKeys direct_imports
all_mods = used_mods ++ filter (`notElem` used_mods) dir_imp_mods
usage_mods = sortBy stableModuleCmp all_mods
-- canonical order is imported, to avoid interface-file
@@ -854,12 +854,14 @@ mk_usage_info pit hsc_env this_mod direct_imports used_names
| isWiredInName name = mv_map -- ignore wired-in names
| otherwise
= case nameModule_maybe name of
- Nothing -> pprPanic "mkUsageInfo: internal name?" (ppr name)
+ Nothing -> ASSERT( isSystemName name ) mv_map
+ -- See Note [Internal used_names]
+
Just mod -> -- This lambda function is really just a
-- specialised (++); originally came about to
-- avoid quadratic behaviour (trac #2680)
extendModuleEnvWith (\_ xs -> occ:xs) mv_map mod [occ]
- where occ = nameOccName name
+ where occ = nameOccName name
-- We want to create a Usage for a home module if
-- a) we used something from it; has something in used_names
@@ -987,6 +989,15 @@ That is, in Y,
In the result of MkIfaceExports, the names are grouped by defining module,
so we may need to split up a single Avail into multiple ones.
+Note [Internal used_names]
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Most of the used_names are External Names, but we can have Internal
+Names too: see Note [Binders in Template Haskell] in Convert, and Trac
+#5362 for an example. Such Names are always
+ - Such Names are always for locally-defined things, for which we
+ don't gather usage info, so we can just ignore them in ent_map
+ - They are always System Names, hence the assert, just as a double check.
+
%************************************************************************
%* *