Add test for adapter function

This commit is contained in:
Tamas Vajk
2022-04-04 16:42:05 +02:00
committed by Ian Lynagh
parent fc66b73e3b
commit 7f94495601
3 changed files with 55 additions and 0 deletions

View File

@@ -206,6 +206,49 @@ reflection.kt:
# 103| 0: [Parameter] l
# 103| 1: [Parameter] l2
# 103| 5: [BlockStmt] { ... }
# 121| 9: [Method] fn1
# 121| 5: [BlockStmt] { ... }
# 121| 0: [ReturnStmt] return ...
# 121| 0: [IntegerLiteral] 5
# 123| 10: [Method] fn2
#-----| 4: (Parameters)
# 123| 0: [Parameter] f
# 123| 5: [BlockStmt] { ... }
# 123| 0: [ReturnStmt] return ...
# 123| 0: [MethodAccess] invoke(...)
# 123| -1: [VarAccess] f
# 125| 11: [Method] adapted
# 125| 5: [BlockStmt] { ... }
# 126| 0: [ExprStmt] <Expr>;
# 126| 0: [MethodAccess] fn2(...)
# 126| -1: [TypeAccess] ReflectionKt
# 126| 0: [StmtExpr] <Stmt>
# 126| 0: [BlockStmt] { ... }
# 126| 0: [LocalTypeDeclStmt] class ...
# 126| 0: [LocalClass]
# 126| 1: [Constructor]
# 126| 5: [BlockStmt] { ... }
# 126| 0: [SuperConstructorInvocationStmt] super(...)
# 126| 1: [Method] fn1
# 126| 5: [BlockStmt] { ... }
# 126| 0: [ExprStmt] <Expr>;
# 126| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
# 126| 0: [TypeAccess] Unit
# 126| 1: [MethodAccess] fn1(...)
# 126| -1: [TypeAccess] ReflectionKt
# 126| 1: [ExprStmt] <Expr>;
# 126| 0: [MemberRefExpr] ...::...
# 126| -4: [AnonymousClass] new Function0<Unit>(...) { ... }
# 126| 1: [Constructor]
# 126| 5: [BlockStmt] { ... }
# 126| 0: [SuperConstructorInvocationStmt] super(...)
# 126| 1: [Method] invoke
# 126| 5: [BlockStmt] { ... }
# 126| 0: [ReturnStmt] return ...
# 126| 0: [MethodAccess] fn1(...)
# 126| -1: [TypeAccess] ReflectionKt
# 126| -3: [TypeAccess] Function0<Unit>
# 126| 0: [TypeAccess] Unit
# 5| 2: [Class] Reflection
# 5| 1: [Constructor] Reflection
# 5| 5: [BlockStmt] { ... }

View File

@@ -51,6 +51,7 @@ functionReferences
| reflection.kt:98:14:98:17 | ...::... | reflection.kt:98:14:98:17 | invoke | reflection.kt:94:1:94:24 | fn |
| reflection.kt:99:14:99:29 | ...::... | reflection.kt:99:14:99:29 | invoke | file://<external>/Class2$Inner.class:0:0:0:0 | Inner<String> |
| reflection.kt:116:40:116:44 | ...::... | reflection.kt:116:40:116:44 | invoke | reflection.kt:115:9:115:27 | fn1 |
| reflection.kt:126:9:126:13 | ...::... | reflection.kt:126:9:126:13 | invoke | reflection.kt:121:1:121:13 | fn1 |
propertyGetReferences
| reflection.kt:10:38:10:42 | ...::... | reflection.kt:10:38:10:42 | get | reflection.kt:33:9:33:23 | getP0 |
| reflection.kt:15:35:15:41 | ...::... | reflection.kt:15:35:15:41 | get | reflection.kt:33:9:33:23 | getP0 |
@@ -114,6 +115,7 @@ callsInsideInvocationMethods
| 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 |
| reflection.kt:116:40:116:44 | ...::... | reflection.kt:116:40:116:44 | new Function1<Integer,Unit>(...) { ... } | reflection.kt:116:40:116:44 | invoke | reflection.kt:116:40:116:44 | fn1(...) | .fn1 |
| reflection.kt:116:40:116:44 | ...::... | reflection.kt:116:40:116:44 | new Function1<Integer,Unit>(...) { ... } | reflection.kt:116:40:116:44 | invoke | reflection.kt:116:40:116:44 | new (...) | . |
| reflection.kt:126:9:126:13 | ...::... | reflection.kt:126:9:126:13 | new Function0<Unit>(...) { ... } | reflection.kt:126:9:126:13 | invoke | reflection.kt:126:9:126:13 | fn1(...) | ReflectionKt.fn1 |
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> |
@@ -225,3 +227,4 @@ modifiers
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | set | public |
| reflection.kt:116:40:116:44 | ...::... | reflection.kt:116:40:116:44 | invoke | override |
| reflection.kt:116:40:116:44 | ...::... | reflection.kt:116:40:116:44 | invoke | public |
| reflection.kt:126:9:126:13 | ...::... | reflection.kt:126:9:126:13 | invoke | public |

View File

@@ -116,3 +116,12 @@ class LocalFn {
val x: KFunction1<Int, Unit> = ::fn1
}
}
fun fn1() = 5
fun fn2(f: () -> Unit) = f()
fun adapted() {
fn2(::fn1)
}