Regression: can't export constructor when conflicting, qualified constructor is also in scope
I ran into this regression when trying to compile the ersatz
library with GHC 8.2.1-rc1. Here is a minimized example:
module Bug (Bits(Bits)) where
import qualified Data.Bits as Bits
newtype Bits = Bits Int
Compiling this with GHC 8.0.2 works fine, but with 8.2.1-rc1, you get this error:
l$ /opt/ghc/8.2.1/bin/ghci Bug.hs
GHCi, version 8.2.0.20170422: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:1:13: error:
• Ambiguous occurrence ‘Bits’
It could refer to either ‘Bits.Bits’,
imported qualified from ‘Data.Bits’ at Bug.hs:3:1-34
or ‘Bits’, defined at Bug.hs:5:1
• In the export: Bits(Bits)
|
1 | module Bug (Bits(Bits)) where
| ^^^^^^^^^^
Despite the fact that Bits
isn't actually ambiguous, since the Bits
from Data.Bits
is qualified.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1-rc2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | high |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | mpickering |
Operating system | |
Architecture |