Skip to content

-Wno-unused-imports doesn't work on redundant {-# SOURCE #-} imports when its on top of the file

Summary

When the flag -Wno-unused-imports is passed on the command line, ghc doesn't warn on redundant {-# SOURCE #-} imports of .hs-boot files. But when the same flag is passed on the top of file in {-# OPTIONS_GHC -Wno-unused-imports #-} the flag is ignored and we get warnings.

Steps to reproduce

Expected behavior

Flag will have same behaviour whether its passed from command line or on top of file

Environment

  • GHC version used: 9.8.1, 9.8.2

Optional:

  • Operating System:
  • System Architecture:
Edited by Pranay Sashank
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information