File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed
infer/tests/codetoanalyze/hack/pulse Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,28 @@ class D extends C {
25
25
const int Dc = 2 ;
26
26
}
27
27
28
+ // a more complex situation that really happens
29
+ trait T1 {
30
+ const int INDEX = C1 :: INDEX ;
31
+ }
32
+
33
+ class C1 {
34
+ use T2 ;
35
+ }
36
+
37
+ trait T2 implements I1 {}
38
+
39
+ interface I1 extends I2 {}
40
+
41
+ interface I2 {
42
+ const int INDEX = 1 ;
43
+ }
44
+
28
45
class Tester {
29
- public static async function mainOK (): Awaitable <void > {
46
+ public static async function mainOK (classname < C > $c ): Awaitable <void > {
30
47
$d = D :: Dc ;
31
48
// at this point we should have called, and marked as
32
- // called, C$static._86init
49
+ // called, C$static._86constinit
33
50
// So the subsequent access to C::Cc shouldn't call constinit first
34
51
$c = C :: Cc ;
35
52
// next bit shows we're dealing with constants in interfaces properly
@@ -41,4 +58,14 @@ class Tester {
41
58
return ; // UAA error
42
59
};
43
60
}
61
+
62
+ // no longer an FP
63
+ public static async function main2OK (): Awaitable <void > {
64
+ if (T1 :: INDEX === 1 ) {
65
+ return ; // should always happen
66
+ }
67
+ $_ = async {
68
+ return ; // UAA error, should be unreachable
69
+ };
70
+ }
44
71
}
You can’t perform that action at this time.
0 commit comments