No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / class_meth11.php
blob0e6f2168187e35ed012a9a1fbf890b9a85c59535
1 <?hh // partial
3 class C {
4 public static function aStaticMeth(): string {
5 return 'C';
8 public function test() {
9 $h = class_meth(static::class, 'aStaticMeth');
10 hh_show($h);
11 echo $h(), ' ';
15 final class D extends C {
16 public function test2() {
17 $g = class_meth(self::class, 'aStaticMeth');
18 hh_show($g);
19 echo $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() {
33 // static::class is the 'use'r class at runtime
34 $h = class_meth(static::class, 'aStaticMeth');
35 hh_show($h);
36 echo $h(), ' ';
40 class E {
41 use MyTr;
44 function main() {
45 $c = new C();
46 echo 'C: ', $c->test(), "\n";
47 $d = new D();
48 echo 'D: ', $d->test(), "\n";
49 $e = new E();
50 echo 'E: ', $e->test(), "\n";
52 main();
54 // Expected output when executed (without hh_show's)
55 // C: C C C
56 // D: C C D
57 // E: MyTr MyTr MyTr