diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-03-01 16:13:44 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-23 13:41:31 -0400 |
commit | 4dc624987a7e000e9e1086a601039afafb7f2d28 (patch) | |
tree | 982838d1ec69844598069ebb225bbf2bd28ffba1 /testsuite | |
parent | b06e5dd8a2b258d5d6f3676c9f424cc09d4d73f3 (diff) | |
download | haskell-4dc624987a7e000e9e1086a601039afafb7f2d28.tar.gz |
Fix behaviour of -Wunused-packages in ghci
Ticket #21110 points out that -Wunused-packages behaves a bit unusually
in GHCi. Now we define the semantics for -Wunused-packages in
interactive mode as follows:
* If you use -Wunused-packages on an initial load then the warning is reported.
* If you explicitly set -Wunused-packages on the command line then the
warning is displayed (until it is disabled)
* If you then subsequently modify the set of available targets by using
:load or :cd (:cd unloads everything) then the warning is (silently)
turned off.
This means that every :r the warning is printed if it's turned on (but you did ask for it).
Fixes #21110
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghci/scripts/T21110.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T21110.script | 7 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T21110.stderr | 5 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T21110A.hs | 1 | ||||
-rwxr-xr-x | testsuite/tests/ghci/scripts/all.T | 3 |
5 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T21110.hs b/testsuite/tests/ghci/scripts/T21110.hs new file mode 100644 index 0000000000..e43090a725 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T21110.hs @@ -0,0 +1,3 @@ +module T21110 where + +import GHC diff --git a/testsuite/tests/ghci/scripts/T21110.script b/testsuite/tests/ghci/scripts/T21110.script new file mode 100644 index 0000000000..bb8375f9f1 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T21110.script @@ -0,0 +1,7 @@ +:set -package ghc -package template-haskell +:l T21110.hs +:set -Wunused-packages +-- Warning about not using template-haskell +:r +-- No warning +:l T21110A.hs diff --git a/testsuite/tests/ghci/scripts/T21110.stderr b/testsuite/tests/ghci/scripts/T21110.stderr new file mode 100644 index 0000000000..202cf086f8 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T21110.stderr @@ -0,0 +1,5 @@ + +<no location info>: warning: [-Wunused-packages] + The following packages were specified via -package or -package-id flags, + but were not needed for compilation: + - template-haskell diff --git a/testsuite/tests/ghci/scripts/T21110A.hs b/testsuite/tests/ghci/scripts/T21110A.hs new file mode 100644 index 0000000000..fd690c87e3 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T21110A.hs @@ -0,0 +1 @@ +module T21110A where diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 0f6ed54ddb..08e431ef33 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -364,3 +364,6 @@ test('T20909', normal, ghci_script, ['T20909.script']) test('T20150', normal, ghci_script, ['T20150.script']) test('T20974', normal, ghci_script, ['T20974.script']) test('T21088', normal, ghci_script, ['T21088.script']) +test('T21110', [extra_files(['T21110A.hs'])], ghci_script, + ['T21110.script']) + |