Fix property references to fake overrides

This commit is contained in:
Tamas Vajk
2022-03-14 16:43:32 +01:00
committed by Ian Lynagh
parent 4eb1e3a47b
commit d6feb58bfc
4 changed files with 89 additions and 4 deletions

View File

@@ -915,3 +915,74 @@ reflection.kt:
# 90| 1: [TypeAccess] Inner<String>
# 90| 0: [TypeAccess] String
# 90| 0: [ThisAccess] this
# 105| 8: [Class] Base1
# 105| 1: [Constructor] Base1
#-----| 4: (Parameters)
# 105| 0: [Parameter] prop1
# 105| 5: [BlockStmt] { ... }
# 105| 0: [SuperConstructorInvocationStmt] super(...)
# 105| 1: [BlockStmt] { ... }
# 105| 0: [ExprStmt] <Expr>;
# 105| 0: [KtInitializerAssignExpr] ...=...
# 105| 0: [VarAccess] prop1
# 105| 2: [Method] getProp1
# 105| 5: [BlockStmt] { ... }
# 105| 0: [ReturnStmt] return ...
# 105| 0: [VarAccess] this.prop1
# 105| -1: [ThisAccess] this
# 105| 2: [Method] setProp1
#-----| 4: (Parameters)
# 105| 0: [Parameter] <set-?>
# 105| 5: [BlockStmt] { ... }
# 105| 0: [ExprStmt] <Expr>;
# 105| 0: [AssignExpr] ...=...
# 105| 0: [VarAccess] this.prop1
# 105| -1: [ThisAccess] this
# 105| 1: [VarAccess] <set-?>
# 105| 2: [FieldDeclaration] int prop1;
# 105| -1: [TypeAccess] int
# 105| 0: [VarAccess] prop1
# 107| 9: [Class] Derived1
# 107| 1: [Constructor] Derived1
#-----| 4: (Parameters)
# 107| 0: [Parameter] prop1
# 107| 5: [BlockStmt] { ... }
# 107| 0: [SuperConstructorInvocationStmt] super(...)
# 107| 0: [VarAccess] prop1
# 108| 2: [Method] fn
# 108| 5: [BlockStmt] { ... }
# 109| 0: [ExprStmt] <Expr>;
# 109| 0: [MethodAccess] println(...)
# 109| -1: [TypeAccess] ConsoleKt
# 109| 0: [PropertyRefExpr] ...::...
# 109| -4: [AnonymousClass] new KMutableProperty0<Integer>(...) { ... }
# 109| 1: [Constructor]
#-----| 4: (Parameters)
# 109| 0: [Parameter] <dispatchReceiver>
# 109| 5: [BlockStmt] { ... }
# 109| 0: [SuperConstructorInvocationStmt] super(...)
# 109| 1: [ExprStmt] <Expr>;
# 109| 0: [AssignExpr] ...=...
# 109| 0: [VarAccess] this.<dispatchReceiver>
# 109| -1: [ThisAccess] this
# 109| 1: [VarAccess] <dispatchReceiver>
# 109| 1: [FieldDeclaration] Derived1 <dispatchReceiver>;
# 109| -1: [TypeAccess] Derived1
# 109| 1: [Method] get
# 109| 5: [BlockStmt] { ... }
# 109| 0: [ReturnStmt] return ...
# 109| 0: [MethodAccess] getProp1(...)
# 109| -1: [VarAccess] this.<dispatchReceiver>
# 109| -1: [ThisAccess] this
# 109| 1: [Method] set
#-----| 4: (Parameters)
# 109| 0: [Parameter] a0
# 109| 5: [BlockStmt] { ... }
# 109| 0: [ReturnStmt] return ...
# 109| 0: [MethodAccess] setProp1(...)
# 109| -1: [VarAccess] this.<dispatchReceiver>
# 109| -1: [ThisAccess] this
# 109| 0: [VarAccess] a0
# 109| -3: [TypeAccess] KMutableProperty0<Integer>
# 109| 0: [TypeAccess] Integer
# 109| 0: [ThisAccess] this

View File

@@ -58,6 +58,7 @@ propertyGetReferences
| reflection.kt:67:17:67:32 | ...::... | reflection.kt:67:17:67:32 | get | reflection.kt:78:13:78:24 | getP2 |
| reflection.kt:68:17:68:34 | ...::... | reflection.kt:68:17:68:34 | get | reflection.kt:78:13:78:24 | getP2 |
| reflection.kt:70:17:70:30 | ...::... | reflection.kt:70:17:70:30 | get | file://<external>/IntCompanionObject.class:0:0:0:0 | getMAX_VALUE |
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | get | reflection.kt:105:18:105:31 | getProp1 |
propertyFieldReferences
| reflection.kt:71:17:71:34 | ...::... | reflection.kt:71:17:71:34 | get | file:///modules/java.base/java/lang/Integer.class:0:0:0:0 | MAX_VALUE |
| reflection.kt:72:17:72:35 | ...::... | reflection.kt:72:17:72:35 | get | file:///modules/java.desktop/java/awt/Rectangle.class:0:0:0:0 | height |
@@ -66,6 +67,7 @@ propertySetReferences
| reflection.kt:22:42:22:48 | ...::... | reflection.kt:22:42:22:48 | set | reflection.kt:34:9:34:23 | setP1 |
| reflection.kt:67:17:67:32 | ...::... | reflection.kt:67:17:67:32 | set | reflection.kt:79:13:79:29 | setP2 |
| reflection.kt:68:17:68:34 | ...::... | reflection.kt:68:17:68:34 | set | reflection.kt:79:13:79:29 | setP2 |
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | set | reflection.kt:105:18:105:31 | setProp1 |
callsInsideInvocationMethods
| reflection.kt:7:49:7:54 | ...::... | reflection.kt:7:49:7:54 | new Function2<Ccc,Integer,Double>(...) { ... } | reflection.kt:7:49:7:54 | invoke | reflection.kt:7:49:7:54 | m(...) | Ccc.m |
| reflection.kt:10:38:10:42 | ...::... | reflection.kt:10:38:10:42 | new KProperty1<C,Integer>(...) { ... } | reflection.kt:10:38:10:42 | get | reflection.kt:10:38:10:42 | getP0(...) | C.getP0 |
@@ -93,6 +95,8 @@ callsInsideInvocationMethods
| reflection.kt:97:14:97:21 | ...::... | reflection.kt:97:14:97:21 | new Function1<String,Class2<String>>(...) { ... } | reflection.kt:97:14:97:21 | invoke | reflection.kt:97:14:97:21 | new Class2<String>(...) | Class2<String>.Class2<String> |
| reflection.kt:98:14:98:17 | ...::... | reflection.kt:98:14:98:17 | new Function1<String,Unit>(...) { ... } | reflection.kt:98:14:98:17 | invoke | reflection.kt:98:14:98:17 | fn(...) | ReflectionKt.fn |
| reflection.kt:99:14:99:29 | ...::... | reflection.kt:99:14:99:29 | new Function1<String,Inner<String>>(...) { ... } | reflection.kt:99:14:99:29 | invoke | reflection.kt:99:14:99:29 | new Inner<String>(...) | Inner<String>.Inner<String> |
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | new KMutableProperty0<Integer>(...) { ... } | reflection.kt:109:17:109:27 | get | reflection.kt:109:17:109:27 | getProp1(...) | Base1.getProp1 |
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | new KMutableProperty0<Integer>(...) { ... } | reflection.kt:109:17:109:27 | set | reflection.kt:109:17:109:27 | setProp1(...) | Base1.setProp1 |
fieldAccessInsideInvocationMethods
| reflection.kt:14:38:14:44 | ...::... | reflection.kt:14:38:14:44 | new Function1<C,Integer>(...) { ... } | reflection.kt:14:38:14:44 | invoke | reflection.kt:14:38:14:44 | this.<dispatchReceiver> |
| reflection.kt:15:35:15:41 | ...::... | reflection.kt:15:35:15:41 | new KProperty0<Integer>(...) { ... } | reflection.kt:15:35:15:41 | get | reflection.kt:15:35:15:41 | this.<dispatchReceiver> |
@@ -113,3 +117,5 @@ fieldAccessInsideInvocationMethods
| reflection.kt:72:17:72:35 | ...::... | reflection.kt:72:17:72:35 | new KMutableProperty0<Integer>(...) { ... } | reflection.kt:72:17:72:35 | set | reflection.kt:72:17:72:35 | this.<dispatchReceiver>.height |
| reflection.kt:90:18:90:24 | ...::... | reflection.kt:90:18:90:24 | new Function1<String,Inner<String>>(...) { ... } | reflection.kt:90:18:90:24 | invoke | reflection.kt:90:18:90:24 | this.<dispatchReceiver> |
| reflection.kt:99:14:99:29 | ...::... | reflection.kt:99:14:99:29 | new Function1<String,Inner<String>>(...) { ... } | reflection.kt:99:14:99:29 | invoke | reflection.kt:99:14:99:29 | this.<dispatchReceiver> |
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | new KMutableProperty0<Integer>(...) { ... } | reflection.kt:109:17:109:27 | get | reflection.kt:109:17:109:27 | this.<dispatchReceiver> |
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | new KMutableProperty0<Integer>(...) { ... } | reflection.kt:109:17:109:27 | set | reflection.kt:109:17:109:27 | this.<dispatchReceiver> |

View File

@@ -101,3 +101,11 @@ fun test() {
fun <T, R> fn11(l: T, transform: (T) -> R) { }
fun <T1, R> fn12(l: T1, l2: (T1) -> R) { }
open class Base1(var prop1: Int) {}
class Derived1(prop1: Int) : Base1(prop1) {
fun fn() {
println(this::prop1)
}
}