Update as and foreach typing for sound dynamic
commitdeb75cde183fb14831ac4f10548a1a645bbc7342
authorScott Owens <sowens@fb.com>
Fri, 18 Dec 2020 16:36:09 +0000 (18 08:36 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 18 Dec 2020 16:43:09 +0000 (18 08:43 -0800)
tree81840375e0dd2bb597318b55efacd7040e20c7ad
parent0a6eafc12b93686565319acb5e1fef3d0ecc3afe
Update as and foreach typing for sound dynamic

Summary: Update the `as` construct to allow `e as dynamic`. This is a type error if the type `t` of `e` is not coerceable to dynamic; otherwise, it just intersects `t` with `dynamic` following the usual refinement strategy. The update to `foreach` was just a refactoring.

Reviewed By: francesco-zappa-nardelli

Differential Revision: D24995112

fbshipit-source-id: a81aeb8d8d4adf2fb8c676f0be0fccf9923b4fc1
hphp/hack/src/typing/typing.ml
hphp/hack/test/sound_dynamic/typing/as.good.php [new file with mode: 0644]
hphp/hack/test/sound_dynamic/typing/as.good.php.exp [new file with mode: 0644]
hphp/hack/test/sound_dynamic/typing/as2.bad.php [new file with mode: 0644]
hphp/hack/test/sound_dynamic/typing/as2.bad.php.exp [new file with mode: 0644]
hphp/hack/test/sound_dynamic/typing/foreach.good.php [new file with mode: 0644]
hphp/hack/test/sound_dynamic/typing/foreach.good.php.exp [new file with mode: 0644]