Untyped variadic function types should not be permitted in strict mode
[hiphop-php.git] / hphp / hack / test / typecheck / covariance_static_function_bad.php
blobb2c5412424357cfce07ec0c338abc19cf78ce86c
1 <?hh // strict
2 class Base {}
3 class Derived extends Base {
4 public function __construct(public int $v) {}
6 class Cov<+T> {
7 public static function foo(T $v): void {}
9 class Concrete extends Cov<Derived> {
10 <<__Override>>
11 public static function foo(Derived $v): void {
12 echo $v->v;
16 class Violate {
17 public static function foo(classname<Concrete> $z): void {
18 self::bar($z);
20 public static function bar(classname<Cov<Base>> $y): void {
21 $y::foo(new Base()); // Concrete::foo tries to coax an `int $v` out of Base!
22 // It's not very effective.
26 //Violate::foo(Concrete::class);