Store RdrName rather than OccName in Holes
In #20472 it was pointed out that you couldn't defer out of scope but the implementation collapsed a RdrName into an OccName to stuff it into a Hole. This leads to the error message for a deferred qualified name dropping the qualification which affects the quality of the error message. This commit adds a bit more structure to a hole, so a hole can replace a RdrName without losing information about what that RdrName was. This is important when printing error messages. I also added a test which checks the Template Haskell deferral of out of scope qualified names works properly. Fixes #22130
Showing
- compiler/GHC/Builtin/Names/TH.hs 5 additions, 3 deletionscompiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/HsToCore/Quote.hs 48 additions, 26 deletionscompiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Parser/PostProcess.hs 1 addition, 1 deletioncompiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Expr.hs 24 additions, 1 deletioncompiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/HsType.hs 2 additions, 2 deletionscompiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs 1 addition, 2 deletionscompiler/GHC/Rename/Module.hs
- compiler/GHC/Tc/Errors.hs 1 addition, 1 deletioncompiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs 8 additions, 8 deletionscompiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Types/Constraint.hs 3 additions, 2 deletionscompiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/Origin.hs 1 addition, 1 deletioncompiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Monad.hs 2 additions, 2 deletionscompiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs 2 additions, 1 deletioncompiler/GHC/Tc/Utils/TcMType.hs
- compiler/Language/Haskell/Syntax/Expr.hs 2 additions, 2 deletionscompiler/Language/Haskell/Syntax/Expr.hs
- libraries/template-haskell/Language/Haskell/TH/Syntax.hs 4 additions, 0 deletionslibraries/template-haskell/Language/Haskell/TH/Syntax.hs
- testsuite/tests/perf/compiler/hard_hole_fits.stderr 1 addition, 1 deletiontestsuite/tests/perf/compiler/hard_hole_fits.stderr
- testsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs 1 addition, 1 deletiontestsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs
- testsuite/tests/quotes/T20472_quotes.hs 6 additions, 0 deletionstestsuite/tests/quotes/T20472_quotes.hs
- testsuite/tests/quotes/all.T 1 addition, 0 deletionstestsuite/tests/quotes/all.T
- testsuite/tests/rename/should_compile/T20472.stderr 4 additions, 2 deletionstestsuite/tests/rename/should_compile/T20472.stderr
Loading
Please register or sign in to comment