[FIR2IR] Provide reflection target to adapted function references
^KT-60259 Fixed Merge-request: KT-MR-11182 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
017784d24f
commit
ff174dbad9
+2
-1
@@ -66,10 +66,11 @@ FILE fqName:<root> fileName:/samConversionInVarargs.kt
|
||||
CALL 'public final fun useVararg (vararg foos: <root>.IFoo): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
foos: VARARG type=kotlin.Array<out <root>.IFoo> varargElementType=<root>.IFoo
|
||||
TYPE_OP type=<root>.IFoo origin=SAM_CONVERSION typeOperand=<root>.IFoo
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE
|
||||
BLOCK type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE
|
||||
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVarargOfInt visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun withVarargOfInt (vararg xs: kotlin.Int): kotlin.String declared in <root>' type=kotlin.String origin=null
|
||||
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
|
||||
GET_VAR 'p0: kotlin.Int declared in <root>.testAdaptedCR.withVarargOfInt' type=kotlin.Int origin=null
|
||||
FUNCTION_REFERENCE 'local final fun withVarargOfInt (p0: kotlin.Int): kotlin.Unit declared in <root>.testAdaptedCR' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE reflectionTarget=public final fun withVarargOfInt (vararg xs: kotlin.Int): kotlin.String declared in <root>
|
||||
|
||||
+8
-4
@@ -31,8 +31,12 @@ fun withVarargOfInt(vararg xs: Int): String {
|
||||
}
|
||||
|
||||
fun testAdaptedCR() {
|
||||
useVararg(foos = [local fun withVarargOfInt(p0: Int) {
|
||||
withVarargOfInt(xs = [p0])
|
||||
}
|
||||
/*-> IFoo */])
|
||||
useVararg(foos = [{ // BLOCK
|
||||
local fun withVarargOfInt(p0: Int) {
|
||||
withVarargOfInt(xs = [p0])
|
||||
}
|
||||
|
||||
::withVarargOfInt
|
||||
} /*-> IFoo */])
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
-2
@@ -35,10 +35,11 @@ FILE fqName:<root> fileName:/samConversionOnCallableReference.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testSamCosntructorOnAdapted (): <root>.KRunnable declared in <root>'
|
||||
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE
|
||||
BLOCK type=kotlin.Function0<kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE
|
||||
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:foo1 visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun foo1 (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
|
||||
FUNCTION_REFERENCE 'local final fun foo1 (): kotlin.Unit declared in <root>.testSamCosntructorOnAdapted' type=kotlin.Function0<kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE reflectionTarget=public final fun foo1 (vararg xs: kotlin.Int): kotlin.Int declared in <root>
|
||||
FUN name:testSamConversion visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun use (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
@@ -48,7 +49,8 @@ FILE fqName:<root> fileName:/samConversionOnCallableReference.kt
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun use (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE
|
||||
BLOCK type=kotlin.Function0<kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE
|
||||
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:foo1 visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun foo1 (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
|
||||
FUNCTION_REFERENCE 'local final fun foo1 (): kotlin.Unit declared in <root>.testSamConversionOnAdapted' type=kotlin.Function0<kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE reflectionTarget=public final fun foo1 (vararg xs: kotlin.Int): kotlin.Int declared in <root>
|
||||
|
||||
Vendored
+15
-8
@@ -18,10 +18,13 @@ fun testSamConstructor(): KRunnable {
|
||||
}
|
||||
|
||||
fun testSamCosntructorOnAdapted(): KRunnable {
|
||||
return local fun foo1() {
|
||||
foo1()
|
||||
}
|
||||
/*-> KRunnable */
|
||||
return { // BLOCK
|
||||
local fun foo1() {
|
||||
foo1()
|
||||
}
|
||||
|
||||
::foo1
|
||||
} /*-> KRunnable */
|
||||
}
|
||||
|
||||
fun testSamConversion() {
|
||||
@@ -29,8 +32,12 @@ fun testSamConversion() {
|
||||
}
|
||||
|
||||
fun testSamConversionOnAdapted() {
|
||||
use(r = local fun foo1() {
|
||||
foo1()
|
||||
}
|
||||
/*-> KRunnable */)
|
||||
use(r = { // BLOCK
|
||||
local fun foo1() {
|
||||
foo1()
|
||||
}
|
||||
|
||||
::foo1
|
||||
} /*-> KRunnable */)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user