JVM IR: fix generation of generic multi-file delegates
This commit is contained in:
+1
-1
@@ -798,7 +798,7 @@ open class WrappedPropertyDescriptor(
|
||||
|
||||
override fun getAccessors(): List<PropertyAccessorDescriptor> = listOfNotNull(getter, setter)
|
||||
|
||||
override fun getTypeParameters(): List<TypeParameterDescriptor> = emptyList()
|
||||
override fun getTypeParameters(): List<TypeParameterDescriptor> = getter?.typeParameters.orEmpty()
|
||||
|
||||
override fun getVisibility() = owner.visibility
|
||||
|
||||
|
||||
+2
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.jvm.lower
|
||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.deepCopyWithWrappedDescriptors
|
||||
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
|
||||
import org.jetbrains.kotlin.backend.common.ir.passTypeArgumentsFrom
|
||||
import org.jetbrains.kotlin.backend.common.lower
|
||||
import org.jetbrains.kotlin.backend.common.lower.InitializersLowering
|
||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||
@@ -164,6 +165,7 @@ private fun IrFunction.createMultifileDelegateIfNeeded(context: JvmBackendContex
|
||||
function.body = context.createIrBuilder(symbol).irBlockBody {
|
||||
val functionForCall = computeFunctionForCall()
|
||||
+irReturn(irCall(functionForCall).also { call ->
|
||||
call.passTypeArgumentsFrom(function)
|
||||
function.extensionReceiverParameter?.let { parameter ->
|
||||
call.extensionReceiver = irGet(parameter)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: A.kt
|
||||
|
||||
@file:kotlin.jvm.JvmMultifileClass
|
||||
@file:kotlin.jvm.JvmName("A")
|
||||
|
||||
package test
|
||||
|
||||
public val <T> Array<out T>.foo: String
|
||||
get() = this[0].toString() + this[1].toString()
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import test.foo
|
||||
|
||||
fun box(): String = arrayOf('O', "K").foo
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// !INHERIT_MULTIFILE_PARTS
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: 1.kt
|
||||
// WITH_RUNTIME
|
||||
|
||||
+5
@@ -16254,6 +16254,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericProperty.kt")
|
||||
public void testGenericProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineMultifileClassMemberFromOtherPackage.kt")
|
||||
public void testInlineMultifileClassMemberFromOtherPackage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt");
|
||||
|
||||
+5
@@ -16254,6 +16254,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericProperty.kt")
|
||||
public void testGenericProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineMultifileClassMemberFromOtherPackage.kt")
|
||||
public void testInlineMultifileClassMemberFromOtherPackage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt");
|
||||
|
||||
+5
@@ -15139,6 +15139,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericProperty.kt")
|
||||
public void testGenericProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineMultifileClassMemberFromOtherPackage.kt")
|
||||
public void testInlineMultifileClassMemberFromOtherPackage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt");
|
||||
|
||||
Reference in New Issue
Block a user