Add static field access test

This commit is contained in:
Tamas Vajk
2022-04-14 15:09:13 +02:00
committed by Ian Lynagh
parent f43296a157
commit 246f228a3b
3 changed files with 16 additions and 10 deletions

View File

@@ -17,7 +17,7 @@ class A {
fun fn(i: Int) : Int {
val x = this.fn(1)
val e = Enu.A
return 5
return B.x
}
enum class Enu {

View File

@@ -8,7 +8,7 @@ public class B {
public int fn(int i) {
int x = this.fn(1);
Enu e = Enu.A;
return 5;
return B.x;
}
public static class C<T> {
@@ -20,4 +20,6 @@ public class B {
public static enum Enu {
A, B, C
}
public static final int x = 5;
}

View File

@@ -71,7 +71,7 @@ A.kt:
# 19| 0: [VarAccess] Enu.A
# 19| -1: [TypeAccess] Enu
# 20| 2: [ReturnStmt] return ...
# 20| 0: [IntegerLiteral] 5
# 20| 0: [VarAccess] x
# 23| 11: [Class] Enu
# 0| 1: [Method] values
# 0| 3: [TypeAccess] Enu[]
@@ -97,13 +97,13 @@ A.kt:
B.java:
# 0| [CompilationUnit] B
# 1| 1: [Class] B
# 2| 1: [Constructor] B
# 2| 2: [Constructor] B
# 2| 5: [BlockStmt] { ... }
# 3| 1: [EmptyStmt] ;
# 6| 2: [Method] fn
# 6| 3: [Method] fn
# 6| 3: [TypeAccess] void
# 6| 5: [BlockStmt] { ... }
# 7| 3: [Method] fn
# 7| 4: [Method] fn
# 7| 3: [TypeAccess] C<C<Integer>>
# 7| 0: [TypeAccess] C<Integer>
# 7| 0: [TypeAccess] Integer
@@ -115,7 +115,7 @@ B.java:
# 7| 5: [BlockStmt] { ... }
# 7| 0: [ReturnStmt] return ...
# 7| 0: [VarAccess] i
# 8| 4: [Method] fn
# 8| 5: [Method] fn
# 8| 3: [TypeAccess] int
#-----| 4: (Parameters)
# 8| 0: [Parameter] i
@@ -133,8 +133,9 @@ B.java:
# 10| 0: [VarAccess] Enu.A
# 10| -1: [TypeAccess] Enu
# 11| 2: [ReturnStmt] return ...
# 11| 0: [IntegerLiteral] 5
# 14| 5: [Class,GenericType,ParameterizedType] C
# 11| 0: [VarAccess] B.x
# 11| -1: [TypeAccess] B
# 14| 6: [Class,GenericType,ParameterizedType] C
#-----| -2: (Generic Parameters)
# 14| 0: [TypeVariable] T
# 15| 2: [Method] fn
@@ -145,7 +146,7 @@ B.java:
# 16| -3: [TypeAccess] C<C<Integer>>
# 16| 0: [TypeAccess] C<Integer>
# 16| 0: [TypeAccess] Integer
# 20| 6: [Class] Enu
# 20| 7: [Class] Enu
# 21| 3: [FieldDeclaration] Enu A;
# 21| -1: [TypeAccess] Enu
# 21| 0: [ClassInstanceExpr] new Enu(...)
@@ -158,3 +159,6 @@ B.java:
# 21| -1: [TypeAccess] Enu
# 21| 0: [ClassInstanceExpr] new Enu(...)
# 21| -3: [TypeAccess] Enu
# 24| 8: [FieldDeclaration] int x;
# 24| -1: [TypeAccess] int
# 24| 0: [IntegerLiteral] 5