Handle hs-boot files in -Wmissing-home-modules (#16551)
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>
Tue, 9 Apr 2019 11:51:29 +0000 (13:51 +0200)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 29 May 2019 14:35:50 +0000 (10:35 -0400)
compiler/main/GhcMake.hs
testsuite/tests/warnings/should_compile/T16551.stderr [new file with mode: 0644]
testsuite/tests/warnings/should_compile/T16551/A.hs [new file with mode: 0644]
testsuite/tests/warnings/should_compile/T16551/B.hs [new file with mode: 0644]
testsuite/tests/warnings/should_compile/T16551/B.hs-boot [new file with mode: 0644]
testsuite/tests/warnings/should_compile/all.T

index ac92f3b..c8442e2 100644 (file)
@@ -184,6 +184,10 @@ warnMissingHomeModules hsc_env mod_graph =
     is_my_target mod (TargetFile target_file _)
       | Just mod_file <- ml_hs_file (ms_location mod)
       = target_file == mod_file ||
+
+           --  Don't warn on B.hs-boot if B.hs is specified (#16551)
+           addBootSuffix target_file == mod_file ||
+
            --  We can get a file target even if a module name was
            --  originally specified in a command line because it can
            --  be converted in guessTarget (by appending .hs/.lhs).
diff --git a/testsuite/tests/warnings/should_compile/T16551.stderr b/testsuite/tests/warnings/should_compile/T16551.stderr
new file mode 100644 (file)
index 0000000..352784c
--- /dev/null
@@ -0,0 +1,3 @@
+[1 of 3] Compiling B[boot]          ( T16551/B.hs-boot, T16551/B.o-boot )
+[2 of 3] Compiling A                ( T16551/A.hs, T16551/A.o )
+[3 of 3] Compiling B                ( T16551/B.hs, T16551/B.o )
diff --git a/testsuite/tests/warnings/should_compile/T16551/A.hs b/testsuite/tests/warnings/should_compile/T16551/A.hs
new file mode 100644 (file)
index 0000000..138a4fa
--- /dev/null
@@ -0,0 +1,2 @@
+module A where
+import {-# SOURCE #-} B
diff --git a/testsuite/tests/warnings/should_compile/T16551/B.hs b/testsuite/tests/warnings/should_compile/T16551/B.hs
new file mode 100644 (file)
index 0000000..af11916
--- /dev/null
@@ -0,0 +1,2 @@
+module B where
+import A
diff --git a/testsuite/tests/warnings/should_compile/T16551/B.hs-boot b/testsuite/tests/warnings/should_compile/T16551/B.hs-boot
new file mode 100644 (file)
index 0000000..c759bc2
--- /dev/null
@@ -0,0 +1 @@
+module B where
index 36e6b1b..fcf0344 100644 (file)
@@ -22,6 +22,7 @@ test('Werror01', normal, compile, [''])
 test('Werror02', normal, compile, [''])
 
 test('MissingMod', normal, multimod_compile, ['MissingMod', '-Wmissing-home-modules'])
+test('T16551', [extra_files(['T16551/'])], multimod_compile, ['T16551/A.hs T16551/B.hs', '-Wmissing-home-modules'])
 
 test('StarBinder', normal, compile, [''])