[GHC] #13352: Strange requirement for re-exported duplicate record fields

#13352: Strange requirement for re-exported duplicate record fields -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 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: -------------------------------------+------------------------------------- In the following example, {{{ module A(A(..)) where data A = A {x::Int} module B(B(..)) where data B = B {x::Bool} {-# LANGUAGE DuplicateRecordFields #-} module C(A(..),B(..)) where import A(A(..)) import B(B(..)) }}} I get an error about `conflicting exports for 'x'`. This doesn't seem right to me: I've got `-XDuplicateRecordFields` exactly where the duplicate occurs. However, I noticed that the if I move the pragma to A.hs, C.hs compiles without error: {{{ {-# LANGUAGE DuplicateRecordFields #-} module A(A(..)) where data A = A {x::Int} module B(B(..)) where data B = B {x::Bool} module C(A(..),B(..)) where import A(A(..)) import B(B(..)) }}} This is bizarre because it is asymmetric (I arbitrarily put the pragma in A.hs, but it need not occur in B.hs), and because no duplicate records exist in module A, but they ''do'' exist in module C, where the pragma isn't needed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13352 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13352: Strange requirement for re-exported duplicate record fields -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | 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: | -------------------------------------+------------------------------------- Changes (by ezyang): * cc: adamagundry (added) Comment: CC'ing adamgundry. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13352#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13352: Strange requirement for re-exported duplicate record fields -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Changes (by adamgundry): * keywords: => orf * cc: adamagundry (removed) * cc: adamgundry (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13352#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13352: Strange requirement for re-exported duplicate record fields -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Comment (by adamgundry): Sorry, I've only just seen this as ezyang's CC missed. :( This is an awkward corner of the `DuplicateRecordFields` implementation: as you've observed, the extension needs to be enabled at the definition site of (all but one of) a set of record fields in order for them to be re-exported by a single module. In principle it would be possible to fix this by changing the implementation to mangle selector names regardless of whether the extension is enabled. However, I suspect this would be a nontrivial amount of work relative to the benefit. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13352#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13352: Strange requirement for re-exported duplicate record fields -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Comment (by tejon): I've just run into this as well, with the additional observation that if module C ''re-exports'' modules A and B, then C must also have `DuplicateRecordFields`. (Of course, C needing it is the immediate intuition anyway; but it's not always true that it's only needed at (n-1 of) the definition points. This is just a slightly annoying curiosity when one controls all the relevant modules, but it seems like it shuts down the extension completely if one is working with external modules that don't have `DuplicateRecordFields` enabled (because why should they, internally there are none). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13352#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC