Permalink
Browse files

Set lambda as non-reactive if it calls into anything that is not stri…

…ctly reactive

Summary: as in title: calling into non-reactive function inside lambda should only reset lambda reactivity and yield no errors

Reviewed By: jamesjwu

Differential Revision: D6865661

fbshipit-source-id: 6d95950bc745ab0615f76a8a8e61b53b29a988c3
  • Loading branch information...
vladima authored and hhvm-bot committed Feb 1, 2018
1 parent cea8d8f commit 9e4f97e500610c91c6a31e7a17c2646687bde757
@@ -4866,9 +4866,9 @@ and call_ ~expected pos env fty el uel =
let pos_def = Reason.to_pos r2 in
let env, var_param = variadic_param env ft in
(* mark current lambda as non-reactive
since it is trying to call non-reactive function *)
if ft.ft_reactive = Nonreactive
(* if lambda is trying to call function that is not
strictly reactive - mark lambda as non-reactive *)
if ft.ft_reactive <> Reactive
then Env.not_lambda_reactive ();
(* Strictly reactive functions can only call stricly reactive functions *)
@@ -0,0 +1,18 @@
<?hh
<<__RxShallow>>
function rxshallow(): void {}
<<__RxLocal>>
function rxlocal(): void {}
function nonreactive(): void {}
function test2(): void {
// OK
$x = () ==> rxshallow();
// OK
$x = () ==> rxlocal();
// OK
$x = () ==> nonreactive();
}

0 comments on commit 9e4f97e

Please sign in to comment.