No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / typehole / T91771566.php
blob916f096208c9e2405dab7742cc34fc61168df2d8
1 <?hh
3 class C {
4 public arraykey $i = 0;
6 public function invalidate(): int {
7 $this->i = "42";
8 return 0;
12 function takes_int(int $_): void {}
14 <<__EntryPoint>>
15 function main1(): void {
16 $c = new C();
17 $v = Vector<int> {0};
18 if ($c->i is int) {
19 // Soundness error call to invalidate must invalidate `$c->i : int`.
20 $v[$c->invalidate()] = $c->i;
21 // HHVM fatals
22 takes_int($v[0]);