Skip to content

Fix two constraint solving problems

Simon Peyton Jones requested to merge wip/T18855 into master

This patch fixes two problems in the constraint solver.

  • An actual bug #18555 (closed): we were floating out a constraint to eagerly, and that was ultimately fatal. It's explained in Note [Do not float blocked constraints] in GHC.Core.Constraint.

    This is all very delicate, but it's all going to become irrelevant when we stop floating constraints (#17656).

  • A major performance infelicity in the flattener. When flattening (ty |> co) we never generated Refl, even when there was nothing at all to do. Result: we would gratuitously rewrite the constraint to exactly the same thing, wasting work. Described in #18413, and came up again in #18855 (closed).

    Solution: exploit the special case by calling the new function castCoercionKind1. See Note [castCoercionKind1] in GHC.Core.Coercion

Merge request reports