Typing step for is-expression, part 1
commitca211b59025eb7d2ea963587bf6ec743300c9777
authorKunal Mehta <kunalm@fb.com>
Wed, 29 Nov 2017 23:52:47 +0000 (29 15:52 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 30 Nov 2017 00:04:57 +0000 (29 16:04 -0800)
tree84ea61c9f47db1777e0a3bb4f9a9b4c94e601e2f
parentcb293fc3c4be6ffad7cc1bcd40809e68d64e4dd0
Typing step for is-expression, part 1

Summary:
This adds a type visitor to validate the hint on the RHS of the expression. Although one would think that we should use decl types for this, we actually use locl types because we will eventually need to drill down through type aliases and type constants. This has the unfortunate side effect of us having to handle types that are impossible to get, like Tany, Terr, etc.

The validator also has a print method for when we need more specific descriptions, which just falls back to `Typing_print.error`.

More tests will be added as I add support for those types.

Reviewed By: dlreeves

Differential Revision: D6275465

fbshipit-source-id: 4eb3dfb87723a268c9b5dd150593b93b1ce8a9a7
19 files changed:
hphp/hack/src/options/globalOptions.ml
hphp/hack/src/options/globalOptions.mli
hphp/hack/src/options/typecheckerOptions.ml
hphp/hack/src/typing/typing.ml
hphp/hack/src/typing/typing_utils.ml
hphp/hack/src/utils/errors/errors.ml
hphp/hack/src/utils/errors/errors_sig.ml
hphp/hack/test/typecheck/is_expression/invalid_hint_class_with_generics.php [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_class_with_generics.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_class_with_generics.php.no_format [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_generic.php [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_generic.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_generic.php.no_format [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_noreturn.php [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_noreturn.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_noreturn.php.no_format [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_void.php [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_void.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_hint_void.php.no_format [new file with mode: 0644]