Duplicate Record Fields do not work properly with Record Pattern Synonyms
Summary
Duplicate Record Fields do not work properly with Record Pattern Synonyms.
Steps to reproduce
When I evaluate the following module in GHC 8.4.4:
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE DuplicateRecordFields #-}
module Test where
data Foo =
Bar { bar :: Int }
| BadBaz { baz :: Int }
pattern Baz :: Int -> Foo
pattern Baz{baz} = BadBaz baz
I get the following error message.
Test.hs:10:13: error:
Multiple declarations of ‘baz’
Declared at: Test.hs:7:14
Test.hs:10:13
|
10 | pattern Baz{baz} = BadBaz baz
Expected behavior
Although pattern records aren't exactly records, I would expect DuplicateRecordFields
to work properly here and allow both declarations.
Environment
- GHC version used: GHC 8.4.4.