Fix stack overflow bug
commit0e60e722c7d5e5b7d1b7a4cd91caded92625614e
authorScott Owens <sowens@meta.com>
Mon, 20 Feb 2023 11:58:17 +0000 (20 03:58 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 20 Feb 2023 11:58:17 +0000 (20 03:58 -0800)
tree3428f1abb3033a6cf706f3894019b48184a6bd6d
parent8dcdbf332839ff76c8b2cb840e5385a8c5cc8ecb
Fix stack overflow bug

Summary: D43271340 (https://github.com/facebook/hhvm/commit/9f4631d2fabbe5d38f6257d76a250925d4131a1a) introduced a stack overflow where `supportdyn` wrappers piled up in the environment. That diff make union and intersection try to aggressively avoid wrapping with supportdyn, including checking if the type to be wrapped was a subtype of supportdyn<mixed> already. The fix is to use a simpler syntactic check when union and intersection is wrapping with supportdyn.

Reviewed By: vassilmladenov

Differential Revision: D43395263

fbshipit-source-id: 15e162f2af4759ebf650d75924805a469647bde3
hphp/hack/src/typing/typing_intersection.ml
hphp/hack/src/typing/typing_union.ml
hphp/hack/src/typing/typing_utils.ml
hphp/hack/src/typing/typing_utils.mli