diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-08-18 12:54:51 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-08-23 13:35:26 -0400 |
commit | c1acfd210153dc78748904467c6be023c702467a (patch) | |
tree | 35b9d956bf90d337c5cb05e7dd548510f0d07d78 /testsuite/tests/cabal | |
parent | 06aa8da540b971bb5756636ea5945c3382662b2f (diff) | |
download | haskell-c1acfd210153dc78748904467c6be023c702467a.tar.gz |
driver: Only check for unused package warning in after succesful downsweep
Before we would check for the unused package warning even if the module
graph was compromised due to an error in downsweep. This is easily
fixed by pushing warmUnusedPackages into depanalE, and then returning
the errors like the other downsweep errors.
Fixes #20242
Diffstat (limited to 'testsuite/tests/cabal')
-rw-r--r-- | testsuite/tests/cabal/t20242/BootNoHeader.cabal | 12 | ||||
-rw-r--r-- | testsuite/tests/cabal/t20242/Foo.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/cabal/t20242/Foo.hs-boot | 1 | ||||
-rw-r--r-- | testsuite/tests/cabal/t20242/Main.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/cabal/t20242/Makefile | 18 | ||||
-rw-r--r-- | testsuite/tests/cabal/t20242/Setup.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/cabal/t20242/T20242.stderr | 5 | ||||
-rw-r--r-- | testsuite/tests/cabal/t20242/all.T | 9 |
8 files changed, 56 insertions, 0 deletions
diff --git a/testsuite/tests/cabal/t20242/BootNoHeader.cabal b/testsuite/tests/cabal/t20242/BootNoHeader.cabal new file mode 100644 index 0000000000..1a20184494 --- /dev/null +++ b/testsuite/tests/cabal/t20242/BootNoHeader.cabal @@ -0,0 +1,12 @@ +cabal-version: 2.4 +name: BootNoHeader +version: 0.1.0.0 + +executable BootNoHeader + main-is: Main.hs + other-modules: Foo + build-depends: base + hs-source-dirs: . + default-language: Haskell2010 + + ghc-options: -Werror=unused-packages diff --git a/testsuite/tests/cabal/t20242/Foo.hs b/testsuite/tests/cabal/t20242/Foo.hs new file mode 100644 index 0000000000..c3707c7a24 --- /dev/null +++ b/testsuite/tests/cabal/t20242/Foo.hs @@ -0,0 +1,4 @@ +module Foo where + +a :: Int +a = 5 diff --git a/testsuite/tests/cabal/t20242/Foo.hs-boot b/testsuite/tests/cabal/t20242/Foo.hs-boot new file mode 100644 index 0000000000..9aa298fba9 --- /dev/null +++ b/testsuite/tests/cabal/t20242/Foo.hs-boot @@ -0,0 +1 @@ +a :: Int diff --git a/testsuite/tests/cabal/t20242/Main.hs b/testsuite/tests/cabal/t20242/Main.hs new file mode 100644 index 0000000000..de3cdee837 --- /dev/null +++ b/testsuite/tests/cabal/t20242/Main.hs @@ -0,0 +1,5 @@ +module Main where + +import {-# SOURCE #-} Foo + +main = putStrLn "Hello, world!" diff --git a/testsuite/tests/cabal/t20242/Makefile b/testsuite/tests/cabal/t20242/Makefile new file mode 100644 index 0000000000..1eab3808e6 --- /dev/null +++ b/testsuite/tests/cabal/t20242/Makefile @@ -0,0 +1,18 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +SETUP = ./Setup -v0 + +T20242: clean + $(MAKE) clean + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup + $(SETUP) clean + $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' + $(SETUP) build || true +ifneq "$(CLEANUP)" "" + $(MAKE) clean +endif + +clean : + $(RM) -r */dist Setup$(exeext) *.o *.hi diff --git a/testsuite/tests/cabal/t20242/Setup.hs b/testsuite/tests/cabal/t20242/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/testsuite/tests/cabal/t20242/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/testsuite/tests/cabal/t20242/T20242.stderr b/testsuite/tests/cabal/t20242/T20242.stderr new file mode 100644 index 0000000000..73c50e8c51 --- /dev/null +++ b/testsuite/tests/cabal/t20242/T20242.stderr @@ -0,0 +1,5 @@ + +Foo.hs-boot:1:1: error: + File name does not match module name: + Saw : ‘Main’ + Expected: ‘Foo’ diff --git a/testsuite/tests/cabal/t20242/all.T b/testsuite/tests/cabal/t20242/all.T new file mode 100644 index 0000000000..4e1c0387ee --- /dev/null +++ b/testsuite/tests/cabal/t20242/all.T @@ -0,0 +1,9 @@ +if config.cleanup: + cleanup = 'CLEANUP=1' +else: + cleanup = 'CLEANUP=0' + +test('T20242', + [extra_files(['Setup.hs', 'BootNoHeader.cabal','Foo.hs', 'Foo.hs-boot', 'Main.hs'])], + run_command, + ['$MAKE -s --no-print-directory T20242 ' + cleanup]) |