Serialize annotations on type parameters in builtins
This commit is contained in:
+6
@@ -71,4 +71,10 @@ open class KotlinSerializerExtensionBase(private val protocol: SerializerExtensi
|
||||
proto.addExtension(protocol.typeAnnotation, annotationSerializer.serializeAnnotation(annotation))
|
||||
}
|
||||
}
|
||||
|
||||
override fun serializeTypeParameter(typeParameter: TypeParameterDescriptor, proto: ProtoBuf.TypeParameter.Builder) {
|
||||
for (annotation in typeParameter.annotations) {
|
||||
proto.addExtension(protocol.typeParameterAnnotation, annotationSerializer.serializeAnnotation(annotation))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class Ann(val value: String)
|
||||
inline fun <reified @Ann("abc") T> foo() {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
public inline fun </*0*/ reified @test.Ann(value = "abc") T> foo(): kotlin.Unit
|
||||
|
||||
@kotlin.annotation.Retention(value = AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) public final annotation class Ann : kotlin.Annotation {
|
||||
public constructor Ann(/*0*/ value: kotlin.String)
|
||||
public final val value: kotlin.String
|
||||
}
|
||||
@@ -62,6 +62,10 @@ class BuiltInsSerializerTest : TestCaseWithTmpdir() {
|
||||
doTest("simple.kt")
|
||||
}
|
||||
|
||||
fun testTypeParameterAnnotation() {
|
||||
doTest("typeParameterAnnotation.kt")
|
||||
}
|
||||
|
||||
fun testNestedClassesAndObjects() {
|
||||
doTest("nestedClassesAndObjects.kt")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user