3 * Copyright (c) 2014, Facebook, Inc.
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the "hack" directory of this source tree.
13 public function foo(): void
{}
16 final class A
<T
as E
> {
18 public function __construct((function(T
): void
) $x) {}
22 function test1
<T
as E
>(): A
<T
> {
23 return new A(meth_caller('E', 'foo'));
26 function test2
<T
as E
>(): A
<T
> {
27 // Type of $f should be
29 $f = meth_caller(E
::class, 'foo');
30 // Now type of $r should be
32 // with constraint that
34 // function(E):void <: function(x):void
36 // x <: E (contravariance), so we're ok
38 // Now we need to check the return type
40 // So by invariance we have x=T, and we're ok
41 // because of the T as E constraint