ForeignFunctionInterface steals "label" undocumentedly from OverloadedRecordDot
Summary
If you compile a program like the following with ForeignFunctionInterface
enabled (as is (mysteriously) default in GHC2021, Haskell2010, but notably not Haskell98), it will fail to parse.
Steps to reproduce
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedRecordDot #-}
module Foo (Node(..)) where
newtype Node = Node
{
label :: ()
}
instance Semigroup Node where
n1 <> n2 = Node
{ label = n1.label <> n2.label
}
~ » with-ghc 924
[nix-shell:~]$ ghc OhNo.hs
[1 of 1] Compiling Foo ( OhNo.hs, OhNo.o )
OhNo.hs:12:18: error: parse error on input ‘label’
|
12 | { label = n1.label <> n2.label
| ^^^^^
However:
[nix-shell:~]$ ghc -XNoForeignFunctionInterface OhNo.hs
[1 of 1] Compiling Foo ( OhNo.hs, OhNo.o )
Expected behavior
I would like the program to compile, or for the syntax-stealing to be documented.
Environment
- GHC version used: 9.2.4
Optional:
- Operating System: Linux/macOS
- System Architecture: x86_64