New inference: improved error message for unresolved type
[hiphop-php.git] / hphp / hack / test / typecheck / this_tparam_bad2.php
blob3432e4657f803884ce3b551c41044199eff6175e
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 interface SomethingElse<T> {}
14 class Foo implements SomethingElse<this> {}
16 function expects1<T as Foo>(SomethingElse<T> $foo): void {}
18 function expects2(SomethingElse<Foo> $foo): void {}
20 function test(Foo $foo): void {
21 // No error since Foo is an 'as' constraint on a generic
22 expects1($foo);
24 // Error because SomethingElse<expression_dependent<Foo>> is different than
25 // SomethingElse<Foo>
26 expects2($foo);