Note [Limited defaulting in the ambiguity check]
When simplifying constraints for the ambiguity check, we don't want full defaulting. E.g. #11947 was an example: f :: Num a => Int -> Int This is ambiguous of course, but we don't want to default the (Num alpha) constraint to (Num Int)! Doing so gives a defaulting warning, but no error. But we still do * tryConstraintDefaulting. Example in T10009 where we have this type signature f :: (UnF (F b) ~ b) => F b -> () We finish up with an equality that is a member of it's [W] hole{co_aF0} {rewriters: {co_aF0}}:: b_aES[tau:1] ~# b_aEP[sk:1] It is not unified because of (REWRITERS) in Note [Unification preconditions] in GHC.Tc.Utils.Unify (`tryConstraintDefaulting` defaults call-stack and exception constraint as well as equalities; but in the case of the ambiguity check we will only see equality constraints. Does not seem worth making a version of `tryConstraintDefaulting` that looks only for equalities.) * tryUnsatisfiableGivens: see Wrinkle [Ambiguity] under point (C) of Note [Implementation of Unsatisfiable constraints] in GHC.Tc.Errors.
References 2
- Implementation of Unsatisfiable constraints GHC.Tc.Errors
- Unification preconditions GHC.Tc.Utils.Unify
Referenced by 2
- GHC.Tc.Solver.Default call site
- Defaulting equalities GHC.Tc.Solver.Default