represent calls to `unsafe_cast` as TAST `Hole`s
commit1e24cb146f75762a397d6076f935060d67fe29bb
authorMichael Thomas <mjt@fb.com>
Fri, 9 Apr 2021 16:03:06 +0000 (9 09:03 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 9 Apr 2021 16:04:31 +0000 (9 09:04 -0700)
tree62fd923999046e68354b145269abd001dc1d61b0
parentab1908a49922f0a5d79e1516f248f637a8b634e2
represent calls to `unsafe_cast` as TAST `Hole`s

Summary:
Currently, calls to `unsafe_cast` are represented with the `Call` constructor. This diff changes this to use the `Hole` constructor so that we have a single way of representing casts on the TAST.

A `Hole` constructor resulting from a call to `unsafe_cast` is disambiguated from one generated during typing by the value of `hole_source`.

When adding a `Hole` for `unsafe_cast` the expression takes the type of the second type argument to the function i.e. the destination type of the cast.

Reviewed By: Wilfred

Differential Revision: D27463985

fbshipit-source-id: 96cbbe29b82645999044bd75c2d2a2e6036e28fb
42 files changed:
hphp/hack/src/typing/typing.ml
hphp/hack/test/holes/HH_FLAGS
hphp/hack/test/holes/call_collection.php [new file with mode: 0644]
hphp/hack/test/holes/call_collection.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_dead_code.php
hphp/hack/test/holes/call_dead_code.php.holes.exp
hphp/hack/test/holes/call_dict.php [new file with mode: 0644]
hphp/hack/test/holes/call_dict.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_generic.php
hphp/hack/test/holes/call_generic.php.holes.exp
hphp/hack/test/holes/call_imm_set.php [new file with mode: 0644]
hphp/hack/test/holes/call_imm_set.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_imm_vector.php [new file with mode: 0644]
hphp/hack/test/holes/call_imm_vector.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_iterable.php [new file with mode: 0644]
hphp/hack/test/holes/call_iterable.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_keyed_traversable.php [new file with mode: 0644]
hphp/hack/test/holes/call_keyed_traversable.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_keyset.php [new file with mode: 0644]
hphp/hack/test/holes/call_keyset.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_pair.php [new file with mode: 0644]
hphp/hack/test/holes/call_pair.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_prim.php
hphp/hack/test/holes/call_prim.php.holes.exp
hphp/hack/test/holes/call_set.php [new file with mode: 0644]
hphp/hack/test/holes/call_set.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_tparam.php [deleted file]
hphp/hack/test/holes/call_tparam.php.holes.exp [deleted file]
hphp/hack/test/holes/call_traversable.php [new file with mode: 0644]
hphp/hack/test/holes/call_traversable.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_tuple.php [new file with mode: 0644]
hphp/hack/test/holes/call_tuple.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_varray.php [new file with mode: 0644]
hphp/hack/test/holes/call_varray.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_varray_or_darray.php [new file with mode: 0644]
hphp/hack/test/holes/call_varray_or_darray.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_vec.php [new file with mode: 0644]
hphp/hack/test/holes/call_vec.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/call_vector.php [new file with mode: 0644]
hphp/hack/test/holes/call_vector.php.holes.exp [new file with mode: 0644]
hphp/hack/test/holes/imprecise_cast.php [new file with mode: 0644]
hphp/hack/test/holes/imprecise_cast.php.holes.exp [new file with mode: 0644]