Disallow ... without type in function typehints
commite0150e695598c3ff115fc40ffd2397692bd885d1
authorKunal Mehta <kunalm@fb.com>
Tue, 16 Jul 2019 22:32:33 +0000 (16 15:32 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 16 Jul 2019 22:39:15 +0000 (16 15:39 -0700)
tree0185414811fe9f2b3191eb2baba18d72c5eac64b
parent27693789530660094e7f6d332898f15089937750
Disallow ... without type in function typehints

Summary:
For function typehints, we used to allow the variadic argument specifier without a typehint. This is an error in strict mode (and can be elevated to an error in partial mode as well). This makes it a parse error in the typechecker, requiring that we specify a typehint. A followup diff will make it a parse error in the compiler as well.

This will make implementation of variadic args for function type structures easier, which will then allow functions with variadic args to be reified type arguments.

Reviewed By: vassilmladenov

Differential Revision: D16231694

fbshipit-source-id: c444b3637c2a97a2c6c3d142c5e55fa7b985a240
12 files changed:
hphp/hack/hhi/func_pointers.hhi
hphp/hack/src/parser/full_fidelity_ast.ml
hphp/hack/test/typecheck/function_hint_with_variadic_parameter_and_arg_with_vararg.php
hphp/hack/test/typecheck/function_hint_with_variadic_parameter_and_arg_with_vararg.php.exp [moved from hphp/hack/test/typecheck/variadics/ellipsis_non_strict_mode_2.php.exp with 100% similarity]
hphp/hack/test/typecheck/variadics/ellipsis_non_strict_mode.php
hphp/hack/test/typecheck/variadics/ellipsis_non_strict_mode_2.php [deleted file]
hphp/hack/test/typecheck/variadics/ellipsis_strict_mode.php
hphp/hack/test/typecheck/variadics/ellipsis_strict_mode.php.exp
hphp/hack/test/typecheck/variadics/ellipsis_strict_mode_2.php [deleted file]
hphp/hack/test/typecheck/variadics/ellipsis_strict_mode_2.php.exp [deleted file]
hphp/hack/test/typecheck/variadics/ellipsis_without_hint.php [new file with mode: 0644]
hphp/hack/test/typecheck/variadics/ellipsis_without_hint.php.exp [new file with mode: 0644]