Skip to content

Bump TcLevel of failing kind equality implication

sheaf requested to merge sheaf/ghc:T20043 into master

When coming across insoluble kind equalities in simplifyAndEmitFlatConstraints, we create an implication that wraps them to avoid them being deferred. The way we avoid the deferral is to create an implication which can only hold equality evidence, as in that case there is nowhere to put deferred type errors. This is explained in Note [Wrapping failing kind equalities] in GHC.Tc.Solver.
However, as we didn't bump the TcLevel of the enclosing implication constraint, we could end up attempting to add evidence terms for outer constraints (e.g. Given typeclass constraints), as in #20043 (closed). This caused a panic, as we are trying to add term evidence to a context which doesn't permit it.

Bumping the TcLevel prevents this from happening. I'm not sure why the TcLevel wasn't bumped in the first place, perhaps @simonpj can chime in.

Merge request reports