summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci
diff options
context:
space:
mode:
authorromes <rodrigo.m.mesquita@gmail.com>2023-02-13 11:43:37 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-02-14 11:34:25 -0500
commit85a1a575f9909bbfa84268a9744f22ca0f0a1593 (patch)
tree143e8577223514713fc5a577f969057b6fb8004c /testsuite/tests/ghci
parente8baecd20cbd764a081c6195959719d4c73e65a8 (diff)
downloadhaskell-85a1a575f9909bbfa84268a9744f22ca0f0a1593.tar.gz
fix: Mark ghci Prelude import as implicit
Fixes #22829 In GHCi, we were creating an import declaration for Prelude but we were not setting it as an implicit declaration. Therefore, ghci's import of Prelude triggered -Wmissing-import-lists. Adds regression test T22829 to testsuite
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r--testsuite/tests/ghci/scripts/ghci038.stdout8
-rw-r--r--testsuite/tests/ghci/should_run/T22829.hs2
-rw-r--r--testsuite/tests/ghci/should_run/all.T1
3 files changed, 7 insertions, 4 deletions
diff --git a/testsuite/tests/ghci/scripts/ghci038.stdout b/testsuite/tests/ghci/scripts/ghci038.stdout
index 8a54abb760..7934cab1b5 100644
--- a/testsuite/tests/ghci/scripts/ghci038.stdout
+++ b/testsuite/tests/ghci/scripts/ghci038.stdout
@@ -1,20 +1,20 @@
-import Prelude -- implicit
+import (implicit) Prelude -- implicit
import Prelude
== map in scope due to explicit 'import Prelude'
map :: (a -> b) -> [a] -> [b]
import Prelude
== still in scope, 'import Prelude ()' is subsumed by 'import Prelude'
map :: (a -> b) -> [a] -> [b]
-import Prelude -- implicit
+import (implicit) Prelude -- implicit
== still in scope, implicit import of Prelude
map :: (a -> b) -> [a] -> [b]
import Prelude ()
== not in scope now
-import Prelude -- implicit
+import (implicit) Prelude -- implicit
x :: (a -> b) -> [a] -> [b]
:module +*Foo -- added automatically
:m -Foo
-import Prelude -- implicit
+import (implicit) Prelude -- implicit
:m +*Foo
:module +*Foo
x :: (a -> b) -> [a] -> [b]
diff --git a/testsuite/tests/ghci/should_run/T22829.hs b/testsuite/tests/ghci/should_run/T22829.hs
new file mode 100644
index 0000000000..c4276496b5
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T22829.hs
@@ -0,0 +1,2 @@
+-- Do nothing, we simply want to load Prelude in ghci with -Wmissing-import-lists and -Werror
+main = pure ()
diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T
index 331ffdb726..96693241dd 100644
--- a/testsuite/tests/ghci/should_run/all.T
+++ b/testsuite/tests/ghci/should_run/all.T
@@ -87,3 +87,4 @@ test('T21300', just_ghci, ghci_script, ['T21300.script'])
test('UnliftedDataType2', just_ghci, compile_and_run, [''])
test('SizedLiterals', [req_interp, extra_files(["SizedLiteralsA.hs"]),extra_hc_opts("-O -fbyte-code-and-object-code -fprefer-byte-code")], compile_and_run, [''])
+test('T22829', just_ghci + [extra_hc_opts("-Wmissing-import-lists -Werror")], compile_and_run, [''])