Don't typecheck too much (or too little) in DerivingVia (#16923)
Previously, GHC would typecheck the `via` type once per class in a `deriving` clause, which caused the problems observed in #16923. This patch restructures some of the functionality in `TcDeriv` and `TcHsType` to avoid this problem. We now typecheck the `via` type exactly once per `deriving` clause and *then* typecheck all of the classes in the clause. See `Note [Don't typecheck too much in DerivingVia]` in `TcDeriv` for the full details.
Showing
- compiler/typecheck/TcDeriv.hs 157 additions, 101 deletionscompiler/typecheck/TcDeriv.hs
- compiler/typecheck/TcHsType.hs 23 additions, 37 deletionscompiler/typecheck/TcHsType.hs
- testsuite/tests/deriving/should_fail/T16923.hs 4 additions, 0 deletionstestsuite/tests/deriving/should_fail/T16923.hs
- testsuite/tests/deriving/should_fail/T16923.stderr 6 additions, 0 deletionstestsuite/tests/deriving/should_fail/T16923.stderr
- testsuite/tests/deriving/should_fail/all.T 1 addition, 0 deletionstestsuite/tests/deriving/should_fail/all.T
Loading
Please register or sign in to comment