summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-12-26 09:41:10 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-24 05:37:52 -0500
commit7bfb30f92f5e21a8aca58068dc970040130433c6 (patch)
tree712f5ade2aec3d9dab981ad0486b02c90f652c97
parent1d1dd3fbfafdb9705076d4c587d5cf47e33b7640 (diff)
downloadhaskell-7bfb30f92f5e21a8aca58068dc970040130433c6.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
-rw-r--r--compiler/GHC/Driver/Make.hs2
-rw-r--r--testsuite/tests/warnings/should_compile/all.T1
-rw-r--r--testsuite/tests/warnings/should_compile/src/src.hs3
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 5a799ab885..9fe8b99787 100644
--- a/testsuite/tests/warnings/should_compile/all.T
+++ b/testsuite/tests/warnings/should_compile/all.T
@@ -55,3 +55,4 @@ test('T18862b', normal, compile, [''])
test('T20312', normal, compile,['-Wall'])
test('T22151', normal, compile, ['-Wredundant-constraints'])
test('T22759', normal, compile, [''])
+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 ()