Improve errors for non-existent labels
This patch fixes #17469, by improving matters when you use non-existent field names in a record construction: data T = MkT { x :: Int } f v = MkT { y = 3 } The check is now made in the renamer, in GHC.Rename.Env.lookupRecFieldOcc. That in turn led to a spurious error in T9975a, which is fixed by making GHC.Rename.Names.extendGlobalRdrEnvRn fail fast if it finds duplicate bindings. See Note [Fail fast on duplicate definitions] in that module for more details. This patch was originated and worked on by Alex D (@nineonine)
Showing
- compiler/GHC/Rename/Env.hs 11 additions, 27 deletionscompiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Names.hs 15 additions, 2 deletionscompiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Utils.hs 7 additions, 1 deletioncompiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Gen/Expr.hs 1 addition, 2 deletionscompiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Pat.hs 1 addition, 8 deletionscompiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Utils/Monad.hs 1 addition, 1 deletioncompiler/GHC/Tc/Utils/Monad.hs
- testsuite/tests/overloadedrecflds/should_fail/T17469.hs 6 additions, 0 deletionstestsuite/tests/overloadedrecflds/should_fail/T17469.hs
- testsuite/tests/overloadedrecflds/should_fail/T17469.stderr 5 additions, 0 deletionstestsuite/tests/overloadedrecflds/should_fail/T17469.stderr
- testsuite/tests/overloadedrecflds/should_fail/T17469A.hs 9 additions, 0 deletionstestsuite/tests/overloadedrecflds/should_fail/T17469A.hs
- testsuite/tests/overloadedrecflds/should_fail/all.T 2 additions, 0 deletionstestsuite/tests/overloadedrecflds/should_fail/all.T
- testsuite/tests/rename/should_fail/T8448.stderr 1 addition, 5 deletionstestsuite/tests/rename/should_fail/T8448.stderr
Loading
Please register or sign in to comment