Skip to content

Cannot suppress "Warning: {-# SOURCE #-} unnecessary in import of ‘A’"

Consider the following three files:

-- A.hs
module A where
-- A.hs-boot
module A where
-- B.hs
module B where

import {-# SOURCE #-} A

When compiling these three files GHC emits a warning and rightly so:

>ghc B.hs

B.hs:3:23: Warning: {-# SOURCE #-} unnecessary in import of  ‘A’
[1 of 3] Compiling A[boot]          ( A.hs-boot, A.o-boot )
[2 of 3] Compiling A                ( A.hs, A.o )
[3 of 3] Compiling B                ( B.hs, B.o )

When on the other hand compiling with -w I expect the warning to go away but it doesn't.

>ghc -w B.hs

B.hs:3:23: Warning: {-# SOURCE #-} unnecessary in import of  ‘A’
[1 of 3] Compiling A[boot]          ( A.hs-boot, A.o-boot )
[2 of 3] Compiling A                ( A.hs, A.o )
[3 of 3] Compiling B                ( B.hs, B.o )
Trac metadata
Trac field Value
Version 7.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Linux
Architecture x86_64 (amd64)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information