Opened 4 months ago

#14747 new bug

DisambiguateRecordFields fails for PatternSynonyms

Reported by: adamgundry Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 8.2.1
Keywords: PatternSynonyms Cc: mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case:
Blocked By: Blocking:
Related Tickets: #11283 Differential Rev(s):
Wiki Page:

Description

Consider:

{-# LANGUAGE PatternSynonyms #-}

module A where

pattern S{x} = [x]
{-# 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.

Change History (0)

Note: See TracTickets for help on using tickets.