Don't suggest `DeriveAnyClass` when instance can't be derived.
Fixes #19692. Prototypical cases: class C1 a where x1 :: a -> Int data G1 = G1 deriving C1 class C2 a where x2 :: a -> Int x2 _ = 0 data G2 = G2 deriving C2 Both of these used to give this suggestion, but for C1 the suggestion would have failed (generated code with undefined methods, which compiles but warns). Now C2 still gives the suggestion but C1 doesn't.
Showing
- compiler/GHC/Tc/Deriv.hs 18 additions, 6 deletionscompiler/GHC/Tc/Deriv.hs
- testsuite/tests/deriving/should_fail/T11509_1.stderr 0 additions, 1 deletiontestsuite/tests/deriving/should_fail/T11509_1.stderr
- testsuite/tests/deriving/should_fail/T19692.hs 63 additions, 0 deletionstestsuite/tests/deriving/should_fail/T19692.hs
- testsuite/tests/deriving/should_fail/T19692.stderr 91 additions, 0 deletionstestsuite/tests/deriving/should_fail/T19692.stderr
- testsuite/tests/deriving/should_fail/all.T 1 addition, 0 deletionstestsuite/tests/deriving/should_fail/all.T
- testsuite/tests/generics/T5462No1.stderr 2 additions, 3 deletionstestsuite/tests/generics/T5462No1.stderr
Loading
Please register or sign in to comment