Draft: Fix combination of ArityType in andArityType without breaking the state hack.
When combining the ArityType of two case branches we need to make the conservative decision to
Before this patch \1. T
when combined with T
would result in \1. T
, the result being that we would then eta-expand the branch of type
T
(even though we concluded it wasn't necessarily safe to do so).
In particular, this goes wrong when the branch contains a call to a join point, if we decide to eta-expand it anyway then the join-point gets oversatured. This is a bit of latent bug which was only triggered quite indirectly by inserting cost-centres but seems like it could have happened in other scenarios.
Therefore the correct result of combining \1. T
and T
is the
conservative T
. This patch corrects the logic in andArityType
to
produce that result.
Fixes #21694 (closed)