Skip to content

Incorrect warnings about unqualified imports being redundant

Mixing qualified and unqualified imports can confuse the compiler.

To reproduce:

Create the file BadWarning.hs.

module BadWarning where

import Data.Map
import qualified Data.Map as M

example = empty

Run ghci -W BadWarning.hs, and you get:

BadWarning.hs:4:1:
    Warning: The import of `Data.Map' is redundant
               except perhaps to import instances from `Data.Map'
             To import instances alone, use: import Data.Map()
Ok, modules loaded: BadWarning.

This looks similar to #3992 (closed), but that bug does not repro for me, so I think the issue is slightly different.

Trac metadata
Trac field Value
Version 7.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information