Instances with Unsatisfiable context should use unsatisfiable for missing methods even when they have defaults
Currently, we only generate method implementations for instances with an Unsatisfiable
context when they have no default implementation. However, this can cause problems, e.g.
{-# OPTIONS_GHC -fdefer-type-errors #-}
module T23816 where
instance Unsatisfiable (Text "Msg") => Eq (a -> b)
bad = id == id
calling bad
will result in a runtime loop due to (==)
having a default definition in terms of (/=)
and vice-versa, when we would rather it throws the unsatisfiable type error.
The fix is to change GHC.Tc.TyCl.Instance.tc_default
to always create an unsatisfiable
RHS even when there is a default method. I will execute.