Simplify array specialization logic
Summary:
This change is mostly aesthetic: I'd like to avoid generating types like "Vec=Vanilla" when the AllowBespokeArrayLikes flag is off. The way to do that is to automatically set the vanilla bit on all specialized RAT ArraySpecs, and rely on typeFromRAT to widen these types to include bespoke array likes when the flag is off. The new logic for typeFromRAT is simple: HHBBC has no knowledge of hidden classes, so we simply widen all types when the flag is on. Specifically, consider the following cases for typeFromRAT:
| Input RAT | with flag off (before) | with flag off (after) | with flag on (both before and after)
| Vec | Vec=Vanilla | Vec | Vec
| Arr | Arr=Vanilla | Arr | Arr
| VArr | Arr=PackedKind | Arr=PackedKind | Arr={PackedKind I Bespoke}
| VecN([Str]) | Vec=N([Str]) | Vec=N([Str]) | Vec={N([Str]) I Bespoke}
As the table shows, we avoid constructing the (useless) specializations Vec=Vanilla and Arr=Vanilla with the flag off, while still keeping around useful specializations with array kinds or RAT info. This diff shouldn't change any generated code and should have no perf effects.
We'll still construct vanilla types with the flag off in a handful of cases - for example, the union Arr=PackedKind | Arr=MixedKind resolves to Arr=Vanilla. I don't care to deal with that, and I definitely don't want to change the core type operations based on this flag.
Reviewed By: ricklavoie
Differential Revision:
D20295067
fbshipit-source-id:
57a77efa42e26eb37244bbc9403239dac7990060