
#14747: DisambiguateRecordFields fails for PatternSynonyms -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple PatternSynonyms | Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: #11283 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider: {{{#!hs {-# LANGUAGE PatternSynonyms #-} module A where pattern S{x} = [x] }}} {{{#!hs {-# LANGUAGE PatternSynonyms, DisambiguateRecordFields #-} module B where import A pattern T{x} = [x] e = S { x = 42 } }}} Compiling module B fails with `Ambiguous occurrence ‘x’` in the definition of `e`. In principle, `DisambiguateRecordFields` should select the field belonging to the `S` "data constructor". However, the current implementation of this works by identifying the parent type constructor, which doesn't exist for a pattern synonym. This continues to fail if `T` is replaced by a data type with a field `x`. If `S` is replaced by a data type, however, it starts working. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14747 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler