Do not create exact types from final classes
commit558fe1f3c14652b329359396949357d463d702ea
authorAndrew Kennedy <akenn@fb.com>
Wed, 29 Dec 2021 13:14:15 +0000 (29 05:14 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 29 Dec 2021 13:16:02 +0000 (29 05:16 -0800)
tree44c8db56626e60d42d6d33ead71759c2f6361983
parent9125552f952e581f9484172ba08dde6a1c18face
Do not create exact types from final classes

Summary: When checking `new C(...)` we currently create a (non-denotable) type `exact C` for the expression. For final classes, this is unnecessary, and can result in mixtures of `C` and `exact C` in unsimplified unions. Let's ensure that we only create `exact C` for non-final classes.

Reviewed By: madgen

Differential Revision: D33348130

fbshipit-source-id: a48cd4b21b3e8ef1ffe74845f16e50e1e262302e
hphp/hack/src/typing/typing.ml
hphp/hack/test/typecheck/tconst/expression_dependent_types_and_final.php.exp
hphp/hack/test/typecheck/try_nested.php.exp
hphp/hack/test/typecheck/try_nested_terminal.php.exp