Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,274
    • Issues 4,274
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 412
    • Merge Requests 412
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13352

Closed
Open
Opened Feb 28, 2017 by Eric Crockett@crockeeaReporter

Strange requirement for re-exported duplicate record fields

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.

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#13352