
#12097: DuplicateRecordFields appears not to work in -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This was [[https://www.reddit.com/r/haskell/comments/4kdzp2/announce_its_official_ghc_801_has_been_released/d3e6syc|noticed]] shortly after the 8.0.1 announcement, {{{ $ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/ben/.ghci λ> :set -XDuplicateRecordFields λ> data A = A {test :: String} λ> data B = B {test :: Int} λ> print $ test (A 42) <interactive>:4:9: error: Ambiguous occurrence ‘test’ It could refer to either the field ‘test’, defined at <interactive>:2:13 or the field ‘test’, defined at <interactive>:3:13 }}} The equivalent program compiled as a module works as expected, {{{#!hs {-# LANGUAGE DuplicateRecordFields #-} module Hi where data A = A { test :: Int } deriving Show data B = B { test :: String } deriving Show x :: A x = A 42 main = do print x print (A 42) }}} {{{ $ runghc Hi.hs A {test = 42} A {test = 42} }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12097 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler