Skip to content

`-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules

The -Wmissing-home-modules feature was implemented in order to be used by Cabal (see also #13129 (closed)), however it turns out that it currently has a minor bug which makes it much less useful for cabal as we can't enable it for executables this way, as Cabal needs to provide the path to the Main module directly.

Consider the following two files:

  • src-lib/M1.hs
module M1 where
  • src-exe/Main.hs
import M1

main = return ()

And now consider the following inconsistent results:

Expected good behaviour:

ghc-8.2.1 -fforce-recomp -Wmissing-home-modules -isrc-lib -isrc-exe Main

<no location info>: warning: [-Wmissing-home-modules]
    Modules are not listed in command line: M1
[1 of 2] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
[2 of 2] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
Linking src-exe/Main ...
ghc-8.2.1 -fforce-recomp -Wmissing-home-modules -isrc-lib -isrc-exe M1 Main
[1 of 2] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
[2 of 2] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
Linking src-exe/Main ...

Unexpected bad behaviour:

ghc-8.2.1 -fforce-recomp -Wmissing-home-modules src-lib/M1.hs src-exe/Main.hs 

<no location info>: warning: [-Wmissing-home-modules]
    Modules are not listed in command line: M1 Main
[1 of 2] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
[2 of 2] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
Linking src-exe/Main ...
ghc-8.2.1 -fforce-recomp -Wmissing-home-modules -isrc-lib M1 src-exe/Main

<no location info>: warning: [-Wmissing-home-modules]
    Modules are not listed in command line: Main
[1 of 2] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
[2 of 2] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
Linking src-exe/Main ...
Trac metadata
Trac field Value
Version 8.2.1-rc1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC Yuras
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information