Skip to content

Fix bug in hasFixedRuntimeRep check in matchExpectedFunTys

sheaf requested to merge sheaf/ghc:T26528 into master

Ticket: #26528 (closed)

This MR fixes a bug in the representation-polymormorphism check in GHC.Tc.Utils.Unify.matchExpectedFunTys. The problem was that we put the coercion resulting from hasFixedRuntimeRep in the wrong place, leading to the Core Lint error reported in #26528 (closed).

The change is that we have to be careful when using mkWpFun: it expects both the expected and actual argument types to have a syntactically fixed RuntimeRep, as explained in Note [WpFun-FRR-INVARIANT] in GHC.Tc.Types.Evidence.

On the way, this patch improves some of the commentary relating to other usages of mkWpFun in the compiler, in particular in the view pattern case of tc_pat. No functional changes, but some stylistic changes to make the code more readable, and make it easier to understand how we are upholding the WpFun-FRR-INVARIANT.

TODO:

Edited by sheaf

Merge request reports

Loading