Skip to content

Commit 8de295b

Browse files
Michael Thomasfacebook-github-bot
authored andcommitted
Add test case for abstract type constant deps
Summary: Adds additional tests to ensure all type constant depdencies are recorded for meth_caller and function refs Reviewed By: geralt-encore Differential Revision: D77732552 fbshipit-source-id: 915d881f6ffc1de8c55ea59afa5dbf930edf7475
1 parent cf8fafa commit 8de295b

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

hphp/hack/test/deps/function_pointer.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?hh
22

3+
class A {}
4+
35
class C {
6+
const type TC = A;
47
public static function foo<T>(T $_): void {}
58
public function bar<T>(T $_): void {}
69
}
@@ -18,3 +21,23 @@ function refBar() : void {
1821
function refQux() : void {
1922
$_ = qux<>;
2023
}
24+
25+
26+
abstract class B {
27+
abstract const type TC1 as C;
28+
const type TC2 = arraykey;
29+
30+
public function buz(this::TC1 $_, this::TC1::TC $_ , this::TC2 $_): void {}
31+
32+
public static function baz(this $_, this::TC1 $_, this::TC1::TC $_ , this::TC2 $_): void {}
33+
}
34+
35+
36+
function refBuz(): void {
37+
$_ = meth_caller(B::class, 'buz');
38+
}
39+
40+
41+
function refBaz(): void {
42+
$_ = B::baz<>;
43+
}
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1+
Const B::TC1 -> Fun refBaz, Fun refBuz, Type B
2+
Const B::TC2 -> Fun refBaz, Fun refBuz, Type B
3+
Const C::TC -> Fun refBaz, Fun refBuz, Type B
14
Fun qux -> Fun refQux
5+
Method B::buz -> Fun refBuz
26
Method C::bar -> Fun refBar
7+
SMethod B::baz -> Fun refBaz
38
SMethod C::foo -> Fun refFoo
4-
Type C -> Fun refBar, Fun refFoo
9+
Type A -> Fun refBaz, Fun refBuz, Type B, Type C
10+
Type B -> Fun refBaz, Fun refBuz
11+
Type C -> Fun refBar, Fun refBaz, Fun refBuz, Fun refFoo, Type B
512
Type HH\Capabilities\WriteProperty -> Fun qux,
613
Fun refBar,
14+
Fun refBaz,
15+
Fun refBuz,
716
Fun refFoo,
817
Fun refQux,
18+
Type B,
919
Type C
10-
Type HH\supportdyn -> Fun qux, Fun refBar, Fun refFoo, Fun refQux, Type C
20+
Type HH\supportdyn -> Fun qux,
21+
Fun refBar,
22+
Fun refBaz,
23+
Fun refBuz,
24+
Fun refFoo,
25+
Fun refQux,
26+
Type C

0 commit comments

Comments
 (0)