checkValidInst: Don't expand synonyms when splitting sigma types
Previously, the checkValidInst
function (used when checking that an instance
declaration is headed by an actual type class, not a type synonym) was using
tcSplitSigmaTy
to split apart the forall
s and instance context. This is
incorrect, however, as tcSplitSigmaTy
expands type synonyms, which can cause
instances headed by quantified constraint type synonyms to be accepted
erroneously.
This patch introduces tcSplitSigmaTyNoView
, a version of tcSplitSigmaTy
that does not expand type synonyms, and uses it in checkValidInst
.
Fixes #22570 (closed).