JVM_IR KT-43459 fix $annotations method receiver type
This commit is contained in:
+7
-2
@@ -152,8 +152,10 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE
|
||||
private fun IrType.erasePropertyAnnotationsExtensionReceiverType(): IrType {
|
||||
// Use raw type of extension receiver to avoid generic signature,
|
||||
// which should not be generated for '...$annotations' method.
|
||||
val classifier = classifierOrFail
|
||||
return if (this is IrSimpleType && isArray()) {
|
||||
if (this !is IrSimpleType) {
|
||||
throw AssertionError("Unexpected property receiver type: $this")
|
||||
}
|
||||
val erasedType = if (isArray()) {
|
||||
when (val arg0 = arguments[0]) {
|
||||
is IrStarProjection -> {
|
||||
// 'Array<*>' becomes 'Array<*>'
|
||||
@@ -171,6 +173,9 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE
|
||||
} else {
|
||||
classifier.typeWith()
|
||||
}
|
||||
return erasedType
|
||||
.withHasQuestionMark(this.hasQuestionMark)
|
||||
.addAnnotations(this.annotations)
|
||||
}
|
||||
|
||||
private fun computeSyntheticMethodName(property: IrProperty): String {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
annotation class Anno
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class TypeAnno
|
||||
|
||||
class A {
|
||||
@Anno
|
||||
val @TypeAnno Int?.a: String
|
||||
get() = ""
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
@kotlin.Metadata
|
||||
public final class A {
|
||||
// source: 'kt43459.kt'
|
||||
public method <init>(): void
|
||||
public synthetic deprecated static @Anno method getA$annotations(p0: java.lang.Integer): void
|
||||
public final @org.jetbrains.annotations.NotNull method getA(@org.jetbrains.annotations.Nullable p0: java.lang.Integer): java.lang.String
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention
|
||||
@kotlin.Metadata
|
||||
public annotation class Anno {
|
||||
// source: 'kt43459.kt'
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target
|
||||
@java.lang.annotation.Retention
|
||||
@java.lang.annotation.Target
|
||||
@kotlin.Metadata
|
||||
public annotation class TypeAnno {
|
||||
// source: 'kt43459.kt'
|
||||
}
|
||||
+5
@@ -246,6 +246,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt43459.kt")
|
||||
public void testKt43459() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43459.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt9320.kt")
|
||||
public void testKt9320() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/kt9320.kt");
|
||||
|
||||
+5
@@ -246,6 +246,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt43459.kt")
|
||||
public void testKt43459() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43459.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt9320.kt")
|
||||
public void testKt9320() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/kt9320.kt");
|
||||
|
||||
Reference in New Issue
Block a user