Skip to content

PmCheck: No ConLike instantiation in pmcheck

Sebastian Graf requested to merge wip/pmcheck-ex_tvs into master

pmcheck used to call refineToAltCon which would refine the knowledge we had about a variable by equating it to a ConLike application. Since we weren't particularly smart about this in the Check module, we simply freshened the constructors existential and term binders utimately through a call to mkOneConFull.

But that instantiation is unnecessary for when we match against a concrete pattern! The pattern will already have fresh binders and field types. So we don't call refineToAltCon from Check anymore.

Subsequently, we can simplify a couple of call sites and functions in PmOracle. Also implementing computeCovered becomes viable and we don't have to live with the hack that was addVarPatVecCt anymore.

A side-effect of not indirectly calling mkOneConFull anymore is that we don't generate the proper strict argument field constraints anymore. Instead we now desugar ConPatOuts as if they had bangs on their strict fields. This implies that PmVar now carries a HsImplBang that we need to respect by a (somewhat ephemeral) non-void check. We fix #17234 (closed) in doing so.

Edited by Sebastian Graf

Merge request reports