[GHC] #9006: GHC accepts import of private data constructor if it has the same name as the type

#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

#9006: GHC accepts import of private data constructor if it has the same name as the type ------------------------------------------------+-------------------------- Reporter: Lemming | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts invalid program | Unknown/Multiple Test Case: rename/should_fail/T9006 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by simonpj): * status: new => closed * testcase: => rename/should_fail/T9006 * resolution: => fixed Comment: Excellent point, thank you. We could merge the fix to the 7.8 branch, but I'm not sure it's worth the bother Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9006#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9006: GHC accepts import of private data constructor if it has the same name as
the type
------------------------------------------------+--------------------------
Reporter: Lemming | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC accepts invalid program | Unknown/Multiple
Test Case: rename/should_fail/T9006 | Difficulty:
Blocking: | Unknown
| Blocked By:
| Related Tickets:
------------------------------------------------+--------------------------
Comment (by simonpj):
Here's the commit
{{{
commit f964cd9c5c411f8a2383cf2b080581a5c3349661
Author: Simon Peyton Jones

#9006: GHC accepts import of private data constructor if it has the same name as the type -------------------------------------+------------------------------------- Reporter: Lemming | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: GHC | Blocked By: accepts invalid program | Related Tickets: Test Case: | rename/should_fail/T9006 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: closed => merge Comment: I don't think this ever got merged, and it showed up again as #9544 Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9006#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9006: GHC accepts import of private data constructor if it has the same name as the type -------------------------------------+------------------------------------- Reporter: Lemming | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.8.4 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: GHC | Blocked By: accepts invalid program | Related Tickets: Test Case: | rename/should_fail/T9006 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * milestone: => 7.8.4 Comment: Merged to 7.8.4. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9006#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC