New inference: expand type before applying narrowing logic
commitb059e7f468afec7df824914e46891af2831adc19
authorAndrew Kennedy <akenn@fb.com>
Wed, 8 May 2019 12:57:31 +0000 (8 05:57 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 8 May 2019 13:01:11 +0000 (8 06:01 -0700)
treeac2098e7b52763493ef2cc3abf410bc7f6d940fc
parentf011b87b0a23084c3b7dac7a645c2cdcbb0a3081
New inference: expand type before applying narrowing logic

Summary: The current logic in `expand_type_and_narrow` does not expand the type (!) before proceeding with the union simplification and narrowing logic. This leads to anomalies - we should always look at the expanded type, even if it just expands to another type variable.

Reviewed By: CatherineGasnier

Differential Revision: D15240876

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