No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / generic_subtyping.php
blobf54d8243894b770c19fb28082b6a30a61d0cd100
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 {}
16 function foo<T as I>(T $x): void {}
18 function test(): void {
19 if(true) {
20 $y = new B();
22 else {
23 $y = new A();
25 foo($y);