No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / generic_subtyping2.php
blob26f6fa19a558ab56458dc2d0d924f90e7e58721d
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 I {}
13 class A extends I {}
14 class B extends I {}
15 class UnrelatedClass {}
17 function foo<T as I>(T $x): void {}
19 function test(bool $b): void {
20 if ($b) {
21 $y = new B();
22 } else {
23 $y = new UnrelatedClass();
25 foo($y);