diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-11-09 12:17:57 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-12-02 19:46:43 -0500 |
commit | 85ecc1a0fd6536149ae2b54f4b1985d80c0e21cb (patch) | |
tree | cc2b165d482960a7251e8e4bb494b8392f40dd50 /testsuite/tests/driver/fat-iface | |
parent | 74c767df770766d8d52e87b9ff7da10f94620a91 (diff) | |
download | haskell-85ecc1a0fd6536149ae2b54f4b1985d80c0e21cb.tar.gz |
Add special case for :Main module in `GHC.IfaceToCore.mk_top_id`
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 'testsuite/tests/driver/fat-iface')
6 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/driver/fat-iface/T22405/Main.hs b/testsuite/tests/driver/fat-iface/T22405/Main.hs new file mode 100644 index 0000000000..d82a4bd93b --- /dev/null +++ b/testsuite/tests/driver/fat-iface/T22405/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = return () diff --git a/testsuite/tests/driver/fat-iface/T22405/Main2.hs b/testsuite/tests/driver/fat-iface/T22405/Main2.hs new file mode 100644 index 0000000000..f497b63315 --- /dev/null +++ b/testsuite/tests/driver/fat-iface/T22405/Main2.hs @@ -0,0 +1,6 @@ +module Main2 where + +main :: IO () +main = return () + + diff --git a/testsuite/tests/driver/fat-iface/T22405/Makefile b/testsuite/tests/driver/fat-iface/T22405/Makefile new file mode 100644 index 0000000000..91d7e1231e --- /dev/null +++ b/testsuite/tests/driver/fat-iface/T22405/Makefile @@ -0,0 +1,17 @@ +TOP=../../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +TEST_HC_OPTS_NO_RTSOPTS = $(filter-out -rtsopts,$(TEST_HC_OPTS)) + +clean: + rm -f *.hi *.hi-fat *.o + +T22405: clean + "$(TEST_HC)" $(TEST_HC_OPTS) -fbyte-code-and-object-code Main + "$(TEST_HC)" $(TEST_HC_OPTS) -fbyte-code-and-object-code Main + +T22405b: clean + "$(TEST_HC)" $(TEST_HC_OPTS) -fbyte-code-and-object-code Main2 -main-is Main2 + "$(TEST_HC)" $(TEST_HC_OPTS) -fbyte-code-and-object-code Main2 -main-is Main2 + diff --git a/testsuite/tests/driver/fat-iface/T22405/T22405.stdout b/testsuite/tests/driver/fat-iface/T22405/T22405.stdout new file mode 100644 index 0000000000..9417491f3d --- /dev/null +++ b/testsuite/tests/driver/fat-iface/T22405/T22405.stdout @@ -0,0 +1,2 @@ +[1 of 2] Compiling Main ( Main.hs, Main.o, interpreted ) +[2 of 2] Linking Main diff --git a/testsuite/tests/driver/fat-iface/T22405/T22405b.stdout b/testsuite/tests/driver/fat-iface/T22405/T22405b.stdout new file mode 100644 index 0000000000..f88f60dc5d --- /dev/null +++ b/testsuite/tests/driver/fat-iface/T22405/T22405b.stdout @@ -0,0 +1,2 @@ +[1 of 2] Compiling Main2 ( Main2.hs, Main2.o, interpreted ) +[2 of 2] Linking Main2 diff --git a/testsuite/tests/driver/fat-iface/T22405/all.T b/testsuite/tests/driver/fat-iface/T22405/all.T new file mode 100644 index 0000000000..d54b27fac1 --- /dev/null +++ b/testsuite/tests/driver/fat-iface/T22405/all.T @@ -0,0 +1,2 @@ +test('T22405', [extra_files(['Main.hs'])], makefile_test, ['T22405']) +test('T22405b', [extra_files(['Main2.hs'])], makefile_test, ['T22405b']) |