Fix build break after oxidized regen
[hiphop-php.git] / hphp / hack / test / typecheck / reactive / test_mutable_assign.php
blob61b221e5b487e975568cc0094ca986989537d1db
1 <?hh // strict
2 class C {
3 <<__Rx>>
4 public function __construct(public int $val) {}
7 <<__Rx>>
8 function basic(): void {
9 $z = \HH\Rx\mutable(new C(7)); // $z is mutable
10 $z->val = 5; // okay
11 $z = 7; // error, cannot change mutability flavor of the local
12 $b = $z; // can reassign an immutable object
14 // $x is mutable(mutably owned)
15 $x = \HH\Rx\mutable(returnsMut());
16 // error, cannot reassign a mutable object
17 $y = $x;
20 <<__Rx, __MutableReturn>>
21 function returnsMut(): C {
22 // UNSAFE