sync the repo
[hiphop-php.git] / hphp / hack / test / typecheck / class_meth11.php
blob4ea8c0e7f3040c3dcd4831b7a8360f6670876488
1 <?hh
3 class C {
4 public static function aStaticMeth(): string {
5 return 'C';
8 public function test(): string {
9 $h = static::aStaticMeth<>;
10 hh_show($h);
11 return $h() . ' ';
15 final class D extends C {
16 public function test2(): string {
17 $g = self::aStaticMeth<>;
18 hh_show($g);
19 return $g() . ' ';
22 public static function aStaticMeth(): string {
23 return 'D';
27 trait MyTr {
28 public static function aStaticMeth(): string {
29 return 'MyTr';
32 public function test(): string {
33 // static::class is the 'use'r class at runtime
34 $h = static::aStaticMeth<>;
35 hh_show($h);
36 return $h() . ' ';
40 class E {
41 use MyTr;
44 <<__EntryPoint>>
45 function main(): void {
46 $c = new C();
47 echo 'C: ', $c->test(), "\n";
48 $d = new D();
49 echo 'D: ', $d->test(), "\n";
50 $e = new E();
51 echo 'E: ', $e->test(), "\n";
54 // Expected output when executed (without hh_show's)
55 // C: C C C
56 // D: C C D
57 // E: MyTr MyTr MyTr