diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-12-26 09:41:10 +0000 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2023-01-25 23:01:09 -0500 |
commit | 330035914aad4787edaf51a6296ec7597ef6081a (patch) | |
tree | 045726b71035ab61a0529a20af96581d514f4eea | |
parent | 8151ec16b018529c9c5ac19e1d45c702111d1dae (diff) | |
download | haskell-330035914aad4787edaf51a6296ec7597ef6081a.tar.gz |
Augment target filepath by working directory when checking if module satisfies target
This fixes a spurious warning in -Wmissing-home-modules.
This is a simple oversight where when looking for the target in the
first place we augment the search by the -working-directory flag but
then fail to do so when checking this warning.
Fixes #22676
(cherry picked from commit 8a47f4e0c1b8e91edef635e6ba05f65df62a416f)
-rw-r--r-- | compiler/GHC/Driver/Make.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/src/src.hs | 3 |
3 files changed, 5 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs index 0d1cf892bd..999bed68b5 100644 --- a/compiler/GHC/Driver/Make.hs +++ b/compiler/GHC/Driver/Make.hs @@ -347,7 +347,7 @@ warnMissingHomeModules dflags targets mod_graph = TargetFile target_file _ | Just mod_file <- ml_hs_file (ms_location mod) -> - target_file == mod_file || + augmentByWorkingDirectory dflags target_file == mod_file || -- Don't warn on B.hs-boot if B.hs is specified (#16551) addBootSuffix target_file == mod_file || diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T index 40d1ce12f0..5efa9c860f 100644 --- a/testsuite/tests/warnings/should_compile/all.T +++ b/testsuite/tests/warnings/should_compile/all.T @@ -53,3 +53,4 @@ test('DerivingTypeable', normal, compile, ['-Wderiving-typeable']) test('T18862a', normal, compile, ['']) test('T18862b', normal, compile, ['']) test('T20312', normal, compile,['-Wall']) +test('T22676', [extra_files(['src'])], multimod_compile, ['src.hs', '-working-dir src -Wmissing-home-modules -v0']) diff --git a/testsuite/tests/warnings/should_compile/src/src.hs b/testsuite/tests/warnings/should_compile/src/src.hs new file mode 100644 index 0000000000..918e213f57 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/src/src.hs @@ -0,0 +1,3 @@ +module Main where + +main = print () |