Add readonly to decl and function types
[hiphop-php.git] / hphp / hack / test / decl / readonly.php
blobb1b3ba9f17a8d4d91114230a13ff1fdafe70420f
1 <?hh // strict
2 <<file:__EnableUnstableFeatures('readonly')>>
3 class Foo {
6 async function returns_readonly() : readonly Awaitable<Foo> {
7 return new Foo();
10 async function returns_normal(): Awaitable<Foo> {
11 return new Foo();
14 class Bar {
15 public readonly Foo $x;
17 public function __construct(
18 public readonly Foo $y,
19 ) {
20 $this->x = new Foo();
22 public readonly function getFoo() : void {
23 $f = /* <<readonly>> */ (Foo $y) ==> {return $y;};
24 $z = readonly function(Foo $f) : void {