Fixed list difference algorithm
[hiphop-php.git] / hphp / hack / test / typecheck / constraints / super_as_covariant.php
blobfa96355f767b027780783f79470c081896f12b1d
1 <?hh // strict
3 class Cov<+T> {}
5 function UseAs<Tv, Tu as Tv>(Cov<Tv> $x, Cov<Tu> $y): Tu {
6 //UNSAFE
9 function UseSuper<Tv super Tu, Tu>(Cov<Tv> $x, Cov<Tu> $y): Tu {
10 //UNSAFE
13 class MyBase {}
14 class MyDerived extends MyBase {}
16 function DoesWork(Cov<MyBase> $cb, Cov<MyDerived> $cd): MyDerived {
17 return UseSuper($cb, $cd);
20 function DoesNotWork(Cov<MyBase> $cb, Cov<MyDerived> $cd): MyDerived {
21 return UseAs($cb, $cd);