Enable safe instanceof in partial mode
commitd37a29ef3c88b2e6d46445e38b55fd335400520d
authorSasha Manzyuk <manzyuk@fb.com>
Thu, 7 Feb 2019 17:00:41 +0000 (7 09:00 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 7 Feb 2019 17:04:30 +0000 (7 09:04 -0800)
tree2c63aee0246acbf858b8cc7083ffdfdaa53b634a
parent8b4dab36fe73b75b2c74f2457271edc13d7b7de5
Enable safe instanceof in partial mode

Summary: If `C` is a generic type of arity `n`, then for the `C` in `$x instanceof C` we will generate a type `C<v1, ..., vn>`, where `v1`, ..., `vn` are fresh type variables.  In strict mode (with `safe_instanceof` enabled), these will be dropped, and replaced by fresh *type parameters*.  But in non-strict mode, they will remain, to be unsafely unified (in legacy type checking) with whatever comes along inside the branch of the conditional.  It's time to get rid of this and enable `safe_instanceof` in non-strict mode.

Reviewed By: andrewjkennedy

Differential Revision: D13987035

fbshipit-source-id: 40106e4cffee9e0972748df2397c8bafcf68d5ad
hphp/hack/src/typing/typing.ml
hphp/hack/test/typecheck/instanceof/instance_of_tparam.php.exp
hphp/hack/test/typecheck/instanceof/instanceof_static_with_reqs.php.exp