Add an upcast expression
Summary:
Add a new expression `expr upcast hint` that checks that the type of expr is a subtype of hint and the whole expression has the type of the hint. It has no runtime effect. This differs from `as` in the following ways
* No runtime check
* The hint must be a supertype of the expression
* Any type should be allowed in the hint, including classes with erased generics and other non-enforceable types
* The hint type is used as the type of the expression, rather than refining with an intersection of both types
This feature will support sound dynamic. Previously, as dynamic was specially recognised and treated differently than other as. This will remove the need for special treatment and also allow things like converting the type of a `vec<int>` into `vec<dynamic>`, which as cannot support.
The feature is currently marked as unstable, and requires the file-level attribute `<<file:__EnableUnstableFeatures('upcast_expression')>>` to use.
Reviewed By: vsiles
Differential Revision:
D30871803
fbshipit-source-id:
b748c1fb8bff94bdbcc2839de15486dd145799e6