[GHC] #13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The `-Wmissing-home-modules` feature was implemented in order to be used by Cabal (see also #13129), 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` {{{#!hs module M1 where }}} - `src-exe/Main.hs` {{{#!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 ... }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: Yuras Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hvr): * owner: (none) => Yuras -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: Yuras Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Yuras): The problem here: when file is passed to command line, we don't know yet the module name at the time we generate the warning. And we can't use the file name to guess the module name because executable main module filename could be anything. What if we just ignore "Main" module unconditionally, and don't generate the warning for it? Will it work for cabal? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

What if we just ignore "Main" module unconditionally, and don't generate
#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: Yuras Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by hvr): Replying to [comment:2 Yuras]: the warning for it? Will it work for cabal? Yeah, I think that's a good enough hack for now. Can we ignore the Main module only when we compile an executable? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: Yuras Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by refold): IMO that makes sense, given that the user can also specify -main-is via ghc-options. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: Yuras Type: bug | Status: patch Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3598 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Yuras): * status: new => patch * differential: => Phab:D3598 Comment: I didn't figured out how to add a test case with subdirectory. hvr, do you know how to do it? Could you please add it? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: Yuras Type: bug | Status: patch Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3598 Wiki Page: | -------------------------------------+------------------------------------- Comment (by hvr): Replying to [comment:5 Yuras]:
I didn't figured out how to add a test case with subdirectory. hvr, do you know how to do it? Could you please add it?
I've found a way (it feels like a minor hack though), I'll soon commandeer phab:D3498 and add what I came up with... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified
modules
-------------------------------------+-------------------------------------
Reporter: hvr | Owner: Yuras
Type: bug | Status: patch
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 8.2.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
error/warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3598
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: Yuras Type: bug | Status: patch Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3598 Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Merged to `ghc-8.2` as 72eade6d7cf47f0738a58f560085acc952248d2c. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13727: `-Wmissing-home-modules` doesn't properly recognize filepath-qualified modules -------------------------------------+------------------------------------- Reporter: hvr | Owner: Yuras Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3598 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13727#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC