Error on self::class on non final classes
[hiphop-php.git] / hphp / hack / test / typecheck / typing_ok_test_cond.php
blobc43e645d51496ecc36bcef275778bde92be38408
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 class A {}
14 function foo(A $x): void {}
16 function test1(?A $x): void {
17 while ($x) {
18 assert($x is A);
19 foo($x);
23 function test2(?A $x): void {
24 while (!$x) {
26 foo($x);
29 function test3(?A $x): void {
30 for (; $x; ) {
31 assert($x is A);
32 foo($x);
36 function test4(?A $x): void {
37 for (; !$x; ) {
39 foo($x);
42 function test5(?A $x): void {
43 if ($x) {
44 foo($x);
48 function test6(?A $x): void {
49 if (!$x) {
50 } else {
51 foo($x);