No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / test_to_sort_construct.php
blob35cdb87b76eac9842f1e01d4233f92669b8e31f2
1 <?hh // strict
2 /**
3 * Copyright (c) 2014, Facebook, Inc.
4 * All rights reserved.
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the "hack" directory of this source tree.
12 // Checking that the initialization of constructors is properly detected
14 class A {
15 private int $x;
17 public function __construct(int $x) {
18 if (true) {
19 $this->x = $x;
20 } else {
21 $y = f();
22 $this->init();
26 private function init(): void {
27 $this->x = 0;
28 $this->init();
32 class B extends A {
34 public function __construct() {
35 parent::__construct(1);
36 $x = new A(0);
41 function f(): int {
42 return 10;