Skip to content
Permalink
Browse files

Move check_param_instantiable to instantiability_check (6/n)

Summary: Move `check_param_instantiable` for Variadic arguments to `tast_check`

Reviewed By: kmeht

Differential Revision: D13803837

fbshipit-source-id: ce19e0fffa4efd64a39c7259d31df010fb8def89
  • Loading branch information...
MaggieMoss authored and hhvm-bot committed Jan 28, 2019
1 parent 9bbcf2b commit 4f7814335c58e19142351522ba2b50d68e827366
@@ -486,7 +486,6 @@ and func env f named_body =
);
(match f.f_variadic with
| FVvariadicArg vparam ->
Typing_instantiability.check_param_instantiable tenv vparam;
if vparam.param_is_reference then
Errors.variadic_byref_param vparam.param_pos
| _ -> ()
@@ -1019,7 +1018,6 @@ and method_ (env, is_static) m =
);
(match m.m_variadic with
| FVvariadicArg vparam ->
Typing_instantiability.check_param_instantiable tenv vparam;
if vparam.param_is_reference then
Errors.variadic_byref_param vparam.param_pos
| _ -> ()
@@ -104,6 +104,11 @@ let check_tparams env tparams =
let check_param env param =
Option.iter param.param_hint (check_hint env)

let check_variadic_param env param =
match param with
| FVvariadicArg vparam -> check_param env vparam
| _ -> ()

let handler = object
inherit Tast_visitor.handler_base

@@ -120,9 +125,12 @@ let handler = object

method! at_fun_ env f =
check_tparams env f.f_tparams;
List.iter f.f_params (check_param env)
List.iter f.f_params (check_param env);
check_variadic_param env f.f_variadic;

method! at_method_ env m =
check_tparams env m.m_tparams;
List.iter m.m_params (check_param env)
end
List.iter m.m_params (check_param env);
check_variadic_param env m.m_variadic;

end
@@ -1,4 +1,4 @@
File "typing_fail_uninstantiable_variadic_func.php", line 12, characters 24-48:
File "typing_fail_uninstantiable_variadic_func.php", line 12, characters 24-51:
CannotBeInstantiatedWithT is uninstantiable (Typing[4002])
File "typing_fail_uninstantiable_variadic_func.php", line 11, characters 22-46:
Declaration is here
@@ -1,4 +1,4 @@
File "typing_fail_uninstantiable_variadic_meth.php", line 15, characters 33-57:
File "typing_fail_uninstantiable_variadic_meth.php", line 15, characters 33-60:
CannotBeInstantiatedWithT is uninstantiable (Typing[4002])
File "typing_fail_uninstantiable_variadic_meth.php", line 11, characters 22-46:
Declaration is here

0 comments on commit 4f78143

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.