Make ty_expr exhaustive on expressions
[hiphop-php.git] / hphp / hack / test / typecheck / readonly / list_assign.php
blob943637ea3a135565bfddd63723101938fec36e07
1 <?hh
2 <<file:__EnableUnstableFeatures('readonly')>>
3 class Bar {}
4 class Foo {
5 public int $prop;
6 public readonly Bar $ro;
7 public Bar $not_ro;
8 public function __construct() {
9 $this->prop = 1;
10 $this->ro = new Bar();
11 $this->not_ro = new Bar();
13 public function set(int $y) : void {
14 $this->prop = $y;
17 public readonly function get() : int {
18 return 4;
23 function test(readonly (Foo, Foo) $x): void {
24 list($a, $b) = $x;
25 $a->prop = 4; // error $a is readonly
26 $b->prop = 4; // error $b is readonly