Solve constraints from top-level groups sooner
Previously, all constraints from all top-level groups (as separated by top-level splices) were lumped together and solved at the end. This could leak metavariables to TH, though, and that's bad. This patch solves each group's constraints before running the next group's splice. Naturally, we now report fewer errors in some cases. One nice benefit is that this also fixes #11680, but in a much simpler way than the original fix for that ticket. Admittedly, the error messages degrade just a bit from the fix from #11680 (previously, we informed users about variables that will be brought into scope below a top-level splice, and now we just report an out-of-scope error), but the amount of complexity required throughout GHC to get that error was just not worth it. This patch thus reverts much of f93c9517. Fixes #16980 Test cases: th/T16980{,a}
Showing
- compiler/GHC/Hs/Expr.hs 8 additions, 107 deletionscompiler/GHC/Hs/Expr.hs
- compiler/deSugar/DsMeta.hs 1 addition, 1 deletioncompiler/deSugar/DsMeta.hs
- compiler/parser/RdrHsSyn.hs 1 addition, 1 deletioncompiler/parser/RdrHsSyn.hs
- compiler/rename/RnExpr.hs 1 addition, 5 deletionscompiler/rename/RnExpr.hs
- compiler/rename/RnSource.hs 1 addition, 1 deletioncompiler/rename/RnSource.hs
- compiler/rename/RnTypes.hs 2 additions, 2 deletionscompiler/rename/RnTypes.hs
- compiler/typecheck/TcBackpack.hs 0 additions, 1 deletioncompiler/typecheck/TcBackpack.hs
- compiler/typecheck/TcCanonical.hs 7 additions, 5 deletionscompiler/typecheck/TcCanonical.hs
- compiler/typecheck/TcErrors.hs 39 additions, 194 deletionscompiler/typecheck/TcErrors.hs
- compiler/typecheck/TcExpr.hs 3 additions, 4 deletionscompiler/typecheck/TcExpr.hs
- compiler/typecheck/TcHsSyn.hs 2 additions, 1 deletioncompiler/typecheck/TcHsSyn.hs
- compiler/typecheck/TcMType.hs 2 additions, 1 deletioncompiler/typecheck/TcMType.hs
- compiler/typecheck/TcRnDriver.hs 7 additions, 3 deletionscompiler/typecheck/TcRnDriver.hs
- compiler/typecheck/TcRnMonad.hs 6 additions, 25 deletionscompiler/typecheck/TcRnMonad.hs
- compiler/typecheck/TcRnTypes.hs 19 additions, 29 deletionscompiler/typecheck/TcRnTypes.hs
- compiler/typecheck/TcSimplify.hs 1 addition, 4 deletionscompiler/typecheck/TcSimplify.hs
- testsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs 2 additions, 2 deletionstestsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs
- testsuite/tests/th/T10267.stderr 0 additions, 51 deletionstestsuite/tests/th/T10267.stderr
- testsuite/tests/th/T11680.stderr 5 additions, 26 deletionstestsuite/tests/th/T11680.stderr
- testsuite/tests/th/T16980.hs 16 additions, 0 deletionstestsuite/tests/th/T16980.hs
Loading
Please register or sign in to comment