Skip to content

Check for loopy superclass dicts in lookupInInerts

Richard Eisenberg requested to merge wip/T20666 into master

See commentary in #20666 (comment 393286) explaining what's going on, but we essentially forgot a check in lookupInInerts that I'm now fixing.

What's strange here is that I'm actually going against the grain of #20666 (closed), which reports a regression: we used to accept a program we now reject. However, analysis shows that we really should have been rejecting the program all along. It turns out that the backdoor through which older GHCs accepted the program was still ajar (though the particular example in #20666 (closed) didn't use it), and this patch closes that door, rejecting more programs.

Happily, the workaround is easy and backward compatible: just add another constraint to the instance involved.

An alternative solution is to re-work Note [Solving superclass constraints], point (sc2), but a way forward does not easily present itself.

Edited by Andreas Klebinger

Merge request reports