Skip to content

Unused modules incorrectly flagged on re-exports

Describe the bug If you add build-depends on a library that only contains re-exports, the -Wunused-packages warning triggers.

To Reproduce

  1. Define a module in an internal library component
  2. Re-export the module in the library component.
  3. Add the library component to a build-depends of an executable component.
  4. Use the module from an executable component.
  5. Enable -Wunused-packages and -Werror on the executable component.
  6. Build the project.

The build fails.

Expected behavior The build should succeed.

System information cabal-3.4.0.0, ghc-8.10.4

Additional context N/A

Originally reported here: https://github.com/haskell/cabal/issues/7357

See the original ticket for example.

Edited by John Ky
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information