Arity: Handle shadowing properly
In #20070 (closed), we noticed that findRhsArity
copes badly with shadowing.
A simple function like g_123 x_123 = x_123
, where the labmda binder shadows,
already regressed badly.
Indeed, the whole arityType
function wasn't thinking about shadowing at all.
I rectified that and established the invariant that ae_join
and am_sigs
should always be disjoint. That entails deleting bindings from ae_join
whenever we add something to am_sigs
and vice versa, which would otherwise be
a bug in the making.
That should fix (but I don't want to close it) #20070 (closed).