Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff5bbee

Browse files
tamasvajkigfoo
authored andcommitted
Change extracted base type of function references
1 parent 55428c0 commit ff5bbee

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,7 @@ open class KotlinFileExtractor(
24582458
/*
24592459
* Extract generated class:
24602460
* ```
2461-
* class C : Any, kotlin.FunctionI<T0,T1, ... TI, R> {
2461+
* class C : kotlin.jvm.internal.FunctionReference, kotlin.FunctionI<T0,T1, ... TI, R> {
24622462
* private dispatchReceiver: TD
24632463
* private extensionReceiver: TE
24642464
* constructor(dispatchReceiver: TD, extensionReceiver: TE) {
@@ -2473,7 +2473,7 @@ open class KotlinFileExtractor(
24732473
* ```
24742474
* or in case of big arity lambdas ????
24752475
* ```
2476-
* class C : Any, kotlin.FunctionN<R> {
2476+
* class C : kotlin.jvm.internal.FunctionReference, kotlin.FunctionN<R> {
24772477
* private receiver: TD
24782478
* constructor(receiver: TD) { super(); this.receiver = receiver; }
24792479
* fun invoke(vararg args: Any?): R {
@@ -2518,7 +2518,10 @@ open class KotlinFileExtractor(
25182518
)
25192519

25202520
val currentDeclaration = declarationStack.peek()
2521-
val id = extractGeneratedClass(ids, listOf(pluginContext.irBuiltIns.anyType, fnInterfaceType), locId, currentDeclaration)
2521+
val baseClass = pluginContext.referenceClass(FqName("kotlin.jvm.internal.FunctionReference"))?.owner?.typeWith()
2522+
?: pluginContext.irBuiltIns.anyType
2523+
2524+
val id = extractGeneratedClass(ids, listOf(baseClass, fnInterfaceType), locId, currentDeclaration)
25222525

25232526
val helper = FunctionReferenceHelper(locId, ids)
25242527

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variableInitializerType
2-
| reflection.kt:5:9:5:54 | KFunction<Double> ref | file://<external>/KFunction.class:0:0:0:0 | KFunction<Double> | reflection.kt:5:49:5:54 | new Function2<Ccc,Integer,Double>(...) { ... } | file://<external>/Function2.class:0:0:0:0 | Function2<Ccc,Integer,Double> | false |
3-
| reflection.kt:5:9:5:54 | KFunction<Double> ref | file://<external>/KFunction.class:0:0:0:0 | KFunction<Double> | reflection.kt:5:49:5:54 | new Function2<Ccc,Integer,Double>(...) { ... } | file://<external>/Object.class:0:0:0:0 | Object | false |
2+
| reflection.kt:5:9:5:54 | KFunction<Double> ref | file://<external>/KFunction.class:0:0:0:0 | KFunction<Double> | reflection.kt:5:49:5:54 | new Function2<Ccc,Integer,Double>(...) { ... } | file://<external>/Function2.class:0:0:0:0 | Function2<Ccc,Integer,Double> | true |
3+
| reflection.kt:5:9:5:54 | KFunction<Double> ref | file://<external>/KFunction.class:0:0:0:0 | KFunction<Double> | reflection.kt:5:49:5:54 | new Function2<Ccc,Integer,Double>(...) { ... } | file://<external>/FunctionReference.class:0:0:0:0 | FunctionReference | true |
44
invocation
55
| reflection.kt:6:21:6:24 | getName(...) | file://<external>/KCallable.class:0:0:0:0 | getName |

0 commit comments

Comments
 (0)