[GHC] #13626: Ambiguity when exporting a data constructor despite qualification
GHC
ghc-devs at haskell.org
Fri Apr 28 07:31:59 UTC 2017
#13626: Ambiguity when exporting a data constructor despite qualification
-------------------------------------+-------------------------------------
Reporter: Lemming | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1-rc2
(Parser) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{
$ cat A.hs
module A where
data T = Cons
$ cat B.hs
module B (T(T)) where
import qualified A
data T = T
$ ghc-8.2.0.20170422 -Wall B.hs
[2 of 2] Compiling B ( B.hs, B.o ) [A changed]
B.hs:1:11: error:
• Ambiguous occurrence ‘T’
It could refer to either ‘A.T’,
imported qualified from ‘A’ at B.hs:3:1-18
or ‘T’, defined at B.hs:5:1
• In the export: T(T)
|
1 | module B (T(T)) where
| ^^^^
}}}
There should be no ambiguity, because there is only one data constructor
named `T`.
Even if `A.T`'s data constructor would also be called `T`
there would be no ambiguity because `A` is imported with qualification.
The problem does not appear, if `B.T`'s data constructor is named `Cons`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13626>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list