No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / class_constant_cycle.php
blob09bf1f53cef13a3933c0c188fcbc1f1a224e70ae
1 <?hh
3 /* cycles without inheritance */
4 class C0 {
5 const int A = C0::B;
6 const int B = C0::A;
9 class D0 {
10 const int A = self::C;
11 const int B = self::A;
12 const int C = self::B;
15 class C {
16 const int A = D::X + Z::L;
17 const int B = self::A;
19 const int W = self::WW;
20 const int WW = Z::L + Z::Y;
22 const int C_SELF = self::C_SELF;
23 const int C_SELF2 = C::C_SELF2;
26 class Z {
27 const int L = 42;
28 const int Y = 42;
31 class D {
32 const int X = C::B;
35 /* cycles with inheritance */
36 class CE {
37 const int X = CF::X;
40 class CF extends CE {}
42 /* Same constant name but no cycle */
43 class C_OK { const int A = 42; }
44 class D_OK { const int A = C_OK::A; } // No error here
46 /* Indirect cycle: we report only in E_KO, not in F_OK */
47 class E_KO {
48 const int A = E_KO::B; // Error here
49 const int B = E_KO::A; // Error here
52 class F_OK {
53 const int A = E_KO::A; // No error here.