getField fails with internal error in GHCi if the field selector was shadowed
This happens only if DuplicateRecordFields
is disabled (I have it enabled in ~/.ghci).
GHCi, version 9.0.1: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/unknown/.ghci
>>> import GHC.Records
>>> data X = X { name :: String }
>>> data Y = Y { name :: String }
>>> getField @"name" $ X "Tom"
"Tom"
GHCi, version 9.0.1: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/unknown/.ghci
>>> :set -XNoDuplicateRecordFields
>>> import GHC.Records
>>> data X = X { name :: String }
>>> data Y = Y { name :: String }
>>> getField @"name" $ X "Tom"
<interactive>:5:1: error:
GHC internal error: ‘Ghci1.name’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: []
cc @adamgundry