diff options
Diffstat (limited to 'compiler/typecheck/TcRnTypes.hs')
-rw-r--r-- | compiler/typecheck/TcRnTypes.hs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 7c9d70e066..ccf2d0d10f 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -2095,6 +2095,16 @@ see dropDerivedWC. For example [D] Int ~ Bool, and we don't want to report that because it's incomprehensible. That is why we don't rewrite wanteds with wanteds! + * We might float out some Wanteds from an implication, leaving behind + their insoluble Deriveds. For example: + + forall a[2]. [W] alpha[1] ~ Int + [W] alpha[1] ~ Bool + [D] Int ~ Bool + + The Derived is insoluble, but we very much want to drop it when floating + out. + But (tiresomely) we do keep *some* Derived constraints: * Type holes are derived constraints, because they have no evidence @@ -2103,8 +2113,7 @@ But (tiresomely) we do keep *some* Derived constraints: * Insoluble kind equalities (e.g. [D] * ~ (* -> *)), with KindEqOrigin, may arise from a type equality a ~ Int#, say. See Note [Equalities with incompatible kinds] in TcCanonical. - These need to be kept because the kind equalities might have different - source locations and hence different error messages. + Keeping these around produces better error messages, in practice. E.g., test case dependent/should_fail/T11471 * We keep most derived equalities arising from functional dependencies |