Remove sub_type parameter from Typing_coercionnightly-2019.09.30
commit3080538d11e5cc2de97dba975aa81f575e6a1628
authorDwayne Reeves <dreeves@fb.com>
Sun, 29 Sep 2019 16:55:24 +0000 (29 09:55 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sun, 29 Sep 2019 16:58:17 +0000 (29 09:58 -0700)
treea2d4cdcf2c91261444d8c054f05b418779863b87
parent45cded89005691625696c2a67d90ea7a7b6f3502
Remove sub_type parameter from Typing_coercion

Summary:
The code in Typing_coercion is more complex then it needs to be, because it supports passing in a different sub type function. This was used in only one place, Typing.anon_coerce_type. The sub type function used was the same everywhere else, but it wasn't obvious since Typing_op.sub_type uses Typing_utils.sub_type instead of Typing_subtype.sub_type.

Once I switched Typing_op.sub_type to call Typing_subtype.sub_type, it was obvious that the same function was being called so I cleaned up a decent amount of code. I also eliminated the requirement of passing in a Pos.t and Typing_reason.ureason since it is only needed for error reporting, and the relevant error is reported in the Errors.try in coerce_type.

Reviewed By: vassilmladenov

Differential Revision: D17651770

fbshipit-source-id: 39d4e6000f7d57bbcc5781b42df375a577dfce06
hphp/hack/src/typing/tast_check/invalid_index_check.ml
hphp/hack/src/typing/typing.ml
hphp/hack/src/typing/typing_array_access.ml
hphp/hack/src/typing/typing_coercion.ml
hphp/hack/src/typing/typing_ops.ml
hphp/hack/src/typing/typing_union.ml