Add to list of canonical unions
Summary:
HHBBC only allows certain types in its type system. It doesn't allow arbitrary union types.
In union_of, we were missing a bunch of types that will come up post the HADVAs flag-flip for HAM. These types already exist. We just weren't including them in the list of possible widened results of union_of.
In particular, TVArr|TDArr = TArr, but there's no corresponding union (short of TInitCell) for TVec|TDict. Losing this type causes type monotonicity failures, as we may infer a value as being TArrLike, drop param type checks, and then convert a union into TInitCell. In this diff, we add support for all variants of TArrLike as union types. In a follow-up, we may add TVec|TDict - but I don't think that type will matter much.
Once we start generating these array types more commonly, we find that a lot of member operations handling is broken. We need to expose methods from type-system.cpp to do append, get, and set on arbitrary array-like input types, use those in interp-minstrp.cpp, and support widening to TArrLike on mutation.
Reviewed By: arnabde03
Differential Revision:
D24710387
fbshipit-source-id:
2705915e2bce8e32f716531c6d59932580d023e1