unit as a record selector with OverloadedRecordDot triggers parse error
Summary
When a record contains a field named unit
, and if this field is used with OverloadedRecordDot
syntax such as foo.unit
, it results in a parse error.
Steps to reproduce
Compile the following code with GHC 9.2.2:
{-# LANGUAGE OverloadedRecordDot #-}
data Foo = Foo
{
unit :: Int
}
blurk :: Foo -> Int
blurk i = i.unit
Should result in:
[nix-shell:~]$ ghc Record.hs
[1 of 1] Compiling Main ( Record.hs, Record.o )
Record.hs:9:13: error: parse error on input ‘unit’
|
9 | blurk i = i.unit
|
Note that using it as a field selector (i.e. unit i
) works fine.
Expected behavior
unit
should be usable when using OverloadedRecordDot
.
Environment
- GHC version used: 9.2.2
Optional:
- Operating System:
- System Architecture: