[GHC] #12097: DuplicateRecordFields appears not to work in

#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

#12097: DuplicateRecordFields appears not to work in GHCi -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12097#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12097: DuplicateRecordFields appears not to work in GHCi -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => invalid Comment: Never mind; in my haste I completed butchered the example. If one adds a `test` in the expressions being printed above typechecking fails in when compiled as a module as well. This is likely due to the typechecking limitations of `DuplicateRecordFields`, although I don't know for certain. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12097#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12097: DuplicateRecordFields appears not to work in GHCi -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: invalid | Keywords: ORF Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * keywords: => ORF Comment: This is indeed expected behaviour. See #11343. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12097#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC