Opened 9 months ago

Closed 9 months ago

#14953 closed bug (fixed)

Panic when exporting duplicate record fields from separate modules

Reported by: lyxia Owned by:
Priority: normal Milestone: 8.6.1
Component: Compiler Version: 8.5
Keywords: ORF Cc: adamgundry, mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash or panic Test Case: overloadedrecflds/should_fail/T14953
Blocked By: Blocking:
Related Tickets: #13352 Differential Rev(s): Phab:D4527
Wiki Page:

Description (last modified by bgamari)

A.hs

{-# LANGUAGE DuplicateRecordFields #-}
module A where
data R = R {unR :: Int}

---

B.hs

{-# LANGUAGE DuplicateRecordFields #-}
module B where
data R = R {unR :: Int}

---

C.hs

{-# LANGUAGE DuplicateRecordFields #-}

module C (module A, module B) where

import A
import B

---

Output of ghc C.hs:

C.hs:3:21: error:ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.5.20180224 for x86_64-unknown-linux):
	exportClashErr
  $sel:unR:R
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
        pprPanic, called at compiler/typecheck/TcRnExports.hs:740:22 in ghc:TcRnExports

Change History (6)

comment:1 Changed 9 months ago by lyxia

Description: modified (diff)

comment:2 Changed 9 months ago by RyanGlScott

Keywords: ORF added

comment:3 Changed 9 months ago by simonpj

Cc: adamgundry mpickering added

Matthew or Adam: might you look?

comment:4 Changed 9 months ago by adamgundry

Differential Rev(s): Phab:D4527
Milestone: 8.6.1
Status: newpatch
Test Case: overloadedrecflds/should_fail/T14953

Fixing the panic was comparatively straightforward, though there is a bigger issue here that re-exports of duplicate record fields are prohibited in surprising cases (see #13352).

comment:5 Changed 9 months ago by Ben Gamari <ben@…>

In fb462f94/ghc:

Fix panic on module re-exports of DuplicateRcordFields

Test Plan: new test overloadedrecflds/should_fail/T14953

Reviewers: mpickering, simonpj, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14953

Differential Revision: https://phabricator.haskell.org/D4527

comment:6 Changed 9 months ago by bgamari

Description: modified (diff)
Resolution: fixed
Status: patchclosed
Note: See TracTickets for help on using tickets.