summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Module.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-11-09 12:17:57 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-11-09 12:32:08 +0000
commit7346a019517822b3a1bf3f26535c7c1f83a12461 (patch)
tree54427682497667ccc2d823e42a8ff45ef367d368 /compiler/GHC/Tc/Module.hs
parent080fffa1015bcc0cff8ab4ad1eeb507fb7a13383 (diff)
downloadhaskell-wip/t22405.tar.gz
Add special case for :Main module in `GHC.IfaceToCore.mk_top_id`wip/t22405
See Note [Root-main Id] The `:Main` special binding is actually defined in the current module (hence don't go looking for it externally) but the module name is rOOT_MAIN rather than the current module so we need this special case. There was already some similar logic in `GHC.Rename.Env` for External Core, but now the "External Core" is in interface files it needs to be moved here instead. Fixes #22405
Diffstat (limited to 'compiler/GHC/Tc/Module.hs')
-rw-r--r--compiler/GHC/Tc/Module.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 68728cd3d7..597de656b7 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -2042,6 +2042,14 @@ This is unusual: it's a LocalId whose Name has a Module from another
module. Tiresomely, we must filter it out again in GHC.Iface.Make, less we
get two defns for 'main' in the interface file!
+When using `-fwrite-if-simplified-core` the root_main_id can end up in an interface file.
+When the interface is read back in we have to add a special case when creating the
+Id because otherwise we would go looking for the :Main module which obviously doesn't
+exist. For this logic see GHC.IfaceToCore.mk_top_id.
+
+There is also some similar (probably dead) logic in GHC.Rename.Env which says it
+was added for External Core which faced a similar issue.
+
*********************************************************
* *