[FIR] KT-52157: Fix missing type parameter annotations
This commit is contained in:
+5
@@ -56,6 +56,11 @@ public class FirLoadCompiledKotlinGenerated extends AbstractFirLoadCompiledKotli
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationInArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnTypeParameter.kt")
|
||||
public void testAnnotationOnTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationOnTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassLiteralArguments.kt")
|
||||
public void testClassLiteralArguments() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/ClassLiteralArguments.kt");
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
public final class Convert<@R|test/Schema|() T, C> : R|kotlin/Any| {
|
||||
public constructor<@R|test/Schema|() T, C>(): R|test/Convert<T, C>|
|
||||
|
||||
}
|
||||
|
||||
@R|kotlin/annotation/Target|(allowedTargets = <implicitArrayOf>(R|kotlin/annotation/AnnotationTarget.TYPE_PARAMETER|())) public final annotation class Schema : R|kotlin/Annotation| {
|
||||
public constructor(): R|test/Schema|
|
||||
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
public final class SimpleTypeParameterAnnotation : R|kotlin/Any| {
|
||||
public final fun <T> foo(x: R|T|): R|kotlin/Unit|
|
||||
public final fun <@R|test/A|() T> foo(x: R|T|): R|kotlin/Unit|
|
||||
|
||||
public constructor(): R|test/SimpleTypeParameterAnnotation|
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
public final class SimpleTypeParameterAnnotation : R|kotlin/Any| {
|
||||
public final fun <T> foo(x: R|T|): R|kotlin/Unit|
|
||||
public final fun <@R|test/A|(x = String(a), y = Double(1.0)) T> foo(x: R|T|): R|kotlin/Unit|
|
||||
|
||||
public constructor(): R|test/SimpleTypeParameterAnnotation|
|
||||
|
||||
|
||||
+5
@@ -24,4 +24,9 @@ class KlibBasedAnnotationDeserializer(
|
||||
val annotations = typeProto.getExtension(KlibMetadataProtoBuf.typeAnnotation).orEmpty()
|
||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadTypeParameterAnnotations(typeParameterProto: ProtoBuf.TypeParameter, nameResolver: NameResolver): List<FirAnnotation> {
|
||||
val annotations = typeParameterProto.getExtension(KlibMetadataProtoBuf.typeParameterAnnotation).orEmpty()
|
||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||
}
|
||||
}
|
||||
+3
@@ -172,6 +172,9 @@ abstract class AbstractAnnotationDeserializer(
|
||||
|
||||
abstract fun loadTypeAnnotations(typeProto: ProtoBuf.Type, nameResolver: NameResolver): List<FirAnnotation>
|
||||
|
||||
open fun loadTypeParameterAnnotations(typeParameterProto: ProtoBuf.TypeParameter, nameResolver: NameResolver) =
|
||||
emptyList<FirAnnotation>()
|
||||
|
||||
fun deserializeAnnotation(
|
||||
proto: ProtoBuf.Annotation,
|
||||
nameResolver: NameResolver,
|
||||
|
||||
+1
@@ -76,6 +76,7 @@ class FirTypeDeserializer(
|
||||
this.containingDeclarationSymbol = containingSymbol ?: error("Top-level type parameter ???")
|
||||
variance = proto.variance.convertVariance()
|
||||
isReified = proto.reified
|
||||
annotations += annotationDeserializer.loadTypeParameterAnnotations(proto, nameResolver)
|
||||
}
|
||||
result[proto.id] = symbol
|
||||
}
|
||||
|
||||
+5
@@ -52,6 +52,11 @@ class JvmBinaryAnnotationDeserializer(
|
||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadTypeParameterAnnotations(typeParameterProto: ProtoBuf.TypeParameter, nameResolver: NameResolver): List<FirAnnotation> {
|
||||
val annotations = typeParameterProto.getExtension(JvmProtoBuf.typeParameterAnnotation).orEmpty()
|
||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadConstructorAnnotations(
|
||||
containerSource: DeserializedContainerSource?,
|
||||
constructorProto: ProtoBuf.Constructor,
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
// See: KT-52157
|
||||
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
public annotation class Schema
|
||||
|
||||
class Convert<@Schema T, C>()
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
public final class Convert</*0*/ @test.Schema T, /*1*/ C> {
|
||||
/*primary*/ public constructor Convert</*0*/ @test.Schema T, /*1*/ C>()
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) public final annotation class Schema : kotlin.Annotation {
|
||||
/*primary*/ public constructor Schema()
|
||||
}
|
||||
+5
@@ -1739,6 +1739,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationInArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnTypeParameter.kt")
|
||||
public void testAnnotationOnTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationOnTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassLiteralArguments.kt")
|
||||
public void testClassLiteralArguments() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/ClassLiteralArguments.kt");
|
||||
|
||||
Generated
+5
@@ -56,6 +56,11 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationInArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnTypeParameter.kt")
|
||||
public void testAnnotationOnTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationOnTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassLiteralArguments.kt")
|
||||
public void testClassLiteralArguments() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/ClassLiteralArguments.kt");
|
||||
|
||||
+5
@@ -1740,6 +1740,11 @@ public class IrLoadJavaTestGenerated extends AbstractIrLoadJavaTest {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationInArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnTypeParameter.kt")
|
||||
public void testAnnotationOnTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationOnTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassLiteralArguments.kt")
|
||||
public void testClassLiteralArguments() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/ClassLiteralArguments.kt");
|
||||
|
||||
Generated
+5
@@ -1739,6 +1739,11 @@ public class LoadJavaUsingJavacTestGenerated extends AbstractLoadJavaUsingJavacT
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationInArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnTypeParameter.kt")
|
||||
public void testAnnotationOnTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationOnTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassLiteralArguments.kt")
|
||||
public void testClassLiteralArguments() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/ClassLiteralArguments.kt");
|
||||
|
||||
+5
@@ -58,6 +58,11 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationInArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnTypeParameter.kt")
|
||||
public void testAnnotationOnTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/AnnotationOnTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassLiteralArguments.kt")
|
||||
public void testClassLiteralArguments() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/annotations/ClassLiteralArguments.kt");
|
||||
|
||||
Reference in New Issue
Block a user