JVM IR: fix IOOBE from remapTypeParameters for synthetic property annotations method
This commit is contained in:
@@ -137,7 +137,7 @@ fun IrValueParameter.copyTo(
|
|||||||
(parent as IrTypeParametersContainer).classIfConstructor,
|
(parent as IrTypeParametersContainer).classIfConstructor,
|
||||||
irFunction.classIfConstructor
|
irFunction.classIfConstructor
|
||||||
),
|
),
|
||||||
varargElementType: IrType? = this.varargElementType,
|
varargElementType: IrType? = this.varargElementType, // TODO: remapTypeParameters here as well
|
||||||
defaultValue: IrExpressionBody? = this.defaultValue,
|
defaultValue: IrExpressionBody? = this.defaultValue,
|
||||||
isCrossinline: Boolean = this.isCrossinline,
|
isCrossinline: Boolean = this.isCrossinline,
|
||||||
isNoinline: Boolean = this.isNoinline
|
isNoinline: Boolean = this.isNoinline
|
||||||
|
|||||||
+9
-1
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.backend.common.BackendContext
|
|||||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||||
import org.jetbrains.kotlin.backend.common.descriptors.WrappedSimpleFunctionDescriptor
|
import org.jetbrains.kotlin.backend.common.descriptors.WrappedSimpleFunctionDescriptor
|
||||||
import org.jetbrains.kotlin.backend.common.ir.copyTo
|
import org.jetbrains.kotlin.backend.common.ir.copyTo
|
||||||
|
import org.jetbrains.kotlin.backend.common.ir.copyTypeParametersFrom
|
||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
@@ -19,7 +20,10 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
|||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
||||||
|
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
||||||
|
import org.jetbrains.kotlin.ir.types.typeWith
|
||||||
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
|
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
|
||||||
|
import org.jetbrains.kotlin.ir.util.render
|
||||||
import org.jetbrains.kotlin.ir.util.transformDeclarationsFlat
|
import org.jetbrains.kotlin.ir.util.transformDeclarationsFlat
|
||||||
import org.jetbrains.kotlin.ir.visitors.*
|
import org.jetbrains.kotlin.ir.visitors.*
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -81,7 +85,11 @@ class PropertiesLowering(
|
|||||||
).apply {
|
).apply {
|
||||||
descriptor.bind(this)
|
descriptor.bind(this)
|
||||||
|
|
||||||
extensionReceiverParameter = declaration.getter?.extensionReceiverParameter?.copyTo(this)
|
val extensionReceiver = declaration.getter?.extensionReceiverParameter
|
||||||
|
if (extensionReceiver != null) {
|
||||||
|
// Use raw type of extension receiver to avoid generic signature, which would be useless for this method.
|
||||||
|
extensionReceiverParameter = extensionReceiver.copyTo(this, type = extensionReceiver.type.classifierOrFail.typeWith())
|
||||||
|
}
|
||||||
|
|
||||||
body = IrBlockBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET)
|
body = IrBlockBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET)
|
||||||
|
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// WITH_REFLECT
|
||||||
|
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
annotation class Simple(val value: String)
|
||||||
|
|
||||||
|
interface A<T>
|
||||||
|
|
||||||
|
@Simple("OK")
|
||||||
|
public val <T> A<T>.p: String
|
||||||
|
get() = TODO()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val o = object : A<Int> {}
|
||||||
|
return (o::p.annotations.single() as Simple).value
|
||||||
|
}
|
||||||
+5
@@ -20301,6 +20301,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/reflection/annotations/findAnnotation.kt");
|
runTest("compiler/testData/codegen/box/reflection/annotations/findAnnotation.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericExtensionProperty.kt")
|
||||||
|
public void testGenericExtensionProperty() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/reflection/annotations/genericExtensionProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("hasAnnotation.kt")
|
@TestMetadata("hasAnnotation.kt")
|
||||||
public void testHasAnnotation() throws Exception {
|
public void testHasAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/reflection/annotations/hasAnnotation.kt");
|
runTest("compiler/testData/codegen/box/reflection/annotations/hasAnnotation.kt");
|
||||||
|
|||||||
+5
@@ -20301,6 +20301,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/reflection/annotations/findAnnotation.kt");
|
runTest("compiler/testData/codegen/box/reflection/annotations/findAnnotation.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericExtensionProperty.kt")
|
||||||
|
public void testGenericExtensionProperty() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/reflection/annotations/genericExtensionProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("hasAnnotation.kt")
|
@TestMetadata("hasAnnotation.kt")
|
||||||
public void testHasAnnotation() throws Exception {
|
public void testHasAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/reflection/annotations/hasAnnotation.kt");
|
runTest("compiler/testData/codegen/box/reflection/annotations/hasAnnotation.kt");
|
||||||
|
|||||||
+5
@@ -19186,6 +19186,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/reflection/annotations/findAnnotation.kt");
|
runTest("compiler/testData/codegen/box/reflection/annotations/findAnnotation.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericExtensionProperty.kt")
|
||||||
|
public void testGenericExtensionProperty() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/reflection/annotations/genericExtensionProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("hasAnnotation.kt")
|
@TestMetadata("hasAnnotation.kt")
|
||||||
public void testHasAnnotation() throws Exception {
|
public void testHasAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/reflection/annotations/hasAnnotation.kt");
|
runTest("compiler/testData/codegen/box/reflection/annotations/hasAnnotation.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user