Don't suggest `DeriveAnyClass` when instance can't be derived.
According to #19692, this isn't a very useful suggestion. Various possibilities: class C a where c :: a -> Int data G = G1 deriving C used to give this suggestion, and the suggestion would have failed. Now doesn't give the suggestion. class C a where c :: a -> Int c _ = 0 data G = G1 deriving C used to give this suggestion, but the suggestion would have succeded. Now doesn't give the suggestion. I believe this is also the case if `C` has no methods at all. Regression. class A deriving instance A Used to give this suggestion, still does. The suggestion succeeds. I don't yet know why it still gives this suggestion. class C1 c class C2 c where dict :: Dict a deriving instance C2 (C1 Int) Used to give this suggestion, still does. The suggestion fails, but would succeed if `dict` had a default (or didn't exist). This comes from `DerivErrOnlyAnyClassDeriveable`. data A = A Int deriving anyclass Eq Used to give this suggestion, still does. The suggestion fails. But since the user explicitly mentioned `anyclass`, it still seems like a reasonable suggestion.
Showing
- compiler/GHC/Tc/Errors/Ppr.hs 1 addition, 5 deletionscompiler/GHC/Tc/Errors/Ppr.hs
- testsuite/tests/deriving/should_fail/T12512.stderr 0 additions, 2 deletionstestsuite/tests/deriving/should_fail/T12512.stderr
- testsuite/tests/generics/T5462No1.stderr 2 additions, 4 deletionstestsuite/tests/generics/T5462No1.stderr
- testsuite/tests/module/mod53.stderr 0 additions, 1 deletiontestsuite/tests/module/mod53.stderr
Loading
Please register or sign in to comment