[codegen] Fix Heisenbug that was causing some executions of Compiled7
to fail. The problem is that OverloadSet must choose types for the
arguments of any overloaded function that are a supertype of the types
that will be dispatched to. We used to make use of TypeAnalyzer's
subtype testing to choose the greatest type, or erase to Any if the
greatest type was non-unique. However, we were computing "greatest
type" in an order-dependent way, such that if we started by comparing
two sibling types we'd immediately erase to Any. Now we instead use
TypeAnalyzer's join operation, erasing to Any if a UnionType? is
obtained (indicating non-unique upper bound).
Two observations: first, it looks like we actually want to erase to
the LUB in type space of the UnionType? rather than just erasing all
the way to Any. But this might not actually make any practical
difference, since it doesn't change the "instanceof" checks and casts
that we end up having to do.
Second: If we include abstract declarations in the set of things whoes
upper bound we compute, and we obtain a union, don't the different
elements of the union necessarily constitute distinct entry points to
the overloaded function? That is, if our Fortress program passes type
checking, surely the static types of any call to an overloaded
function must be a subset of some one (or more) of the types mentioned
in the union type we obtain. Can we exploit this in some way to get
simpler dispatch, albeit with more than one entry point depending upon
static types?