fix of type variable being discarded with env
commit1285bc070815d038884e8d131618ad48dd389b03
authorCatherine Gasnier <catg@fb.com>
Mon, 27 Jan 2020 18:40:48 +0000 (27 10:40 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 27 Jan 2020 18:44:56 +0000 (27 10:44 -0800)
treecf944dc26efc647475804ca3ec3b1bf38e5ea2cc
parentb32b377009d3f70250aa51960ea32e430061440e
fix of type variable being discarded with env

Summary: When subtyping Tdestructure, in some cases we create a Traversable<#1> where #1 is a fresh type variable (see inline comment for where this happens). This Traversable type ends up in a proposition which is sometimes ends up being conjuncted with an unsat prop created with `invalid_with` (instead of `invalid_env_with), which discards the environment containing #1. To fix that, we replace the calls to `invalid_with` with `invalid_env_with`.

Differential Revision: D19534215

fbshipit-source-id: b2da7af8e403bac705a74b4ddcf60891756dade8
hphp/hack/src/typing/typing_subtype.ml
hphp/hack/test/typecheck/tyvar_exn1.php [new file with mode: 0644]
hphp/hack/test/typecheck/tyvar_exn1.php.exp [new file with mode: 0644]