[GHC] #9006: GHC accepts import of private data constructor if it has the same name as the type
GHC
ghc-devs at haskell.org
Thu Apr 17 15:01:19 UTC 2014
#9006: GHC accepts import of private data constructor if it has the same name as
the type
--------------------------+------------------------------------------------
Reporter: | Owner:
Lemming | Status: new
Type: bug | Milestone:
Priority: normal | Version: 7.8.2
Component: | Operating System: Unknown/Multiple
Compiler | Type of failure: GHC accepts invalid program
Keywords: | Test Case:
Architecture: | Blocking:
Unknown/Multiple |
Difficulty: |
Unknown |
Blocked By: |
Related Tickets: |
--------------------------+------------------------------------------------
{{{
$ cat A.hs B.hs
module A (T) where
data T = T
module B where
import A (T(T))
}}}
`ghci-7.8.2` accepts module B, whereas `ghci-7.6.3` and `ghci-7.4.2` say:
{{{
B.hs:3:11: Module `A' does not export `T(T)'
}}}
For this bug to happen it is important, that the data constructor has the
same name as the type.
I.e. if you rename the data constructor to, say, `Cons`, then `ghci-7.8.2`
will emit the same error as earlier versions.
The bug is not dramatic, since if you try to actually use the imported
data constructor then ghc will say
{{{
B.hs:20:5:
Not in scope: data constructor ‘T’
}}}
However this error message is very confusing, because it suggests that `T`
is not in scope although you imported it correctly.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9006>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list