[GHC] #13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope

GHC ghc-devs at haskell.org
Thu Apr 27 17:12:05 UTC 2017


#13622: Regression: can't export constructor when conflicting, qualified
constructor is also in scope
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:  8.2.1
          Component:  Compiler       |           Version:  8.2.1-rc2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I ran into this regression when trying to compile the `ersatz` library
 with GHC 8.2.1-rc1. Here is a minimized example:

 {{{#!hs
 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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list