Minor. Render annotations on type parameters
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> topFun(): kotlin.Int
|
||||
public fun </*0*/ @A1() @A2(some = 3) @A2() @A1() @A2(some = "Test") T> topFun(): kotlin.Int
|
||||
|
||||
public final annotation class A1 : kotlin.Annotation {
|
||||
public constructor A1()
|
||||
@@ -22,6 +22,6 @@ public final class SomeClass {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ T> method(): kotlin.Int
|
||||
public final fun </*0*/ @A1() @A2(some = 3) @A2() @A1() @A2(some = "Test") T> method(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
public val </*0*/ T> T.topProp: kotlin.Int
|
||||
public val </*0*/ @A1() @A2(some = 3) @A2() @A1() @A2(some = "Test") T> T.topProp: kotlin.Int
|
||||
|
||||
public final annotation class A1 : kotlin.Annotation {
|
||||
public constructor A1()
|
||||
@@ -19,7 +19,7 @@ public final annotation class A2 : kotlin.Annotation {
|
||||
|
||||
public final class SomeClass {
|
||||
public constructor SomeClass()
|
||||
public final val </*0*/ T> T.field: kotlin.Int
|
||||
public final val </*0*/ @A1() @A2(some = 3) @A2() @A1() @A2(some = "Test") T> T.field: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
package
|
||||
|
||||
public val </*0*/ T> T.topProp: kotlin.Int
|
||||
public val </*0*/ @A() @B(i = 3) T> T.topProp: kotlin.Int
|
||||
@A() public fun foo(): kotlin.Unit
|
||||
public fun foo(/*0*/ i: @A() kotlin.Int): kotlin.Unit
|
||||
public fun </*0*/ T> test(/*0*/ t: @A() T): T
|
||||
public fun </*0*/ T> test2(/*0*/ t: T): T
|
||||
public fun </*0*/ T> topFun(): kotlin.Int
|
||||
public fun </*0*/ @C() T> test2(/*0*/ t: T): T
|
||||
public fun </*0*/ @A() @B(i = 3) T> topFun(): kotlin.Int
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) public final annotation class A : kotlin.Annotation {
|
||||
public constructor A()
|
||||
@@ -34,13 +34,13 @@ public final class Class1 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ T> method(): kotlin.Int
|
||||
public final fun </*0*/ @A() @B(i = 3) T> method(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Class2 {
|
||||
public constructor Class2()
|
||||
public final val </*0*/ T> T.field: kotlin.Int
|
||||
public final val </*0*/ @A() @B(i = 3) T> T.field: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
+2
-2
@@ -2,6 +2,6 @@ package
|
||||
|
||||
public fun test(/*0*/ map: kotlin.collections.Map<kotlin.Int, kotlin.String>): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) @kotlin.jvm.JvmName(name = "containsAny") @kotlin.internal.LowPriorityInOverloadResolution() public fun </*0*/ T> kotlin.collections.Iterable<T>.contains1(/*0*/ element: T): kotlin.Int
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ T> kotlin.collections.Iterable<T>.contains1(/*0*/ element: T): kotlin.Boolean
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes() T> kotlin.collections.Iterable<T>.contains1(/*0*/ element: T): kotlin.Boolean
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) @kotlin.jvm.JvmName(name = "getAny") @kotlin.internal.LowPriorityInOverloadResolution() public fun </*0*/ K, /*1*/ V> kotlin.collections.Map<K, V>.get1(/*0*/ key: kotlin.Any?): kotlin.Int
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ K, /*1*/ V> kotlin.collections.Map<out K, V>.get1(/*0*/ key: K): V?
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes() K, /*1*/ V> kotlin.collections.Map<out K, V>.get1(/*0*/ key: K): V?
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ T> assertEquals1(/*0*/ t1: T, /*1*/ t2: T): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes() T> assertEquals1(/*0*/ t1: T, /*1*/ t2: T): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public open class Foo {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ T> assertEquals1(/*0*/ t1: T, /*1*/ t2: T): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ T> expect1(/*0*/ expected: T, /*1*/ block: () -> T): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes() T> assertEquals1(/*0*/ t1: T, /*1*/ t2: T): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes() T> expect1(/*0*/ expected: T, /*1*/ block: () -> T): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
public fun test1(/*0*/ a: A, /*1*/ b: B, /*2*/ c: C): kotlin.Unit
|
||||
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ package test
|
||||
|
||||
public final class SimpleTypeParameterAnnotation {
|
||||
/*primary*/ public constructor SimpleTypeParameterAnnotation()
|
||||
public final fun </*0*/ T> foo(/*0*/ x: T): kotlin.Unit
|
||||
public final fun </*0*/ @test.A() T> foo(/*0*/ x: T): kotlin.Unit
|
||||
}
|
||||
|
||||
compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotationWithArguments.txt
Vendored
+1
-1
@@ -10,5 +10,5 @@ package test
|
||||
|
||||
public final class SimpleTypeParameterAnnotation {
|
||||
/*primary*/ public constructor SimpleTypeParameterAnnotation()
|
||||
public final fun </*0*/ T> foo(/*0*/ x: T): kotlin.Unit
|
||||
public final fun </*0*/ @test.A(x = "a", y = 1.0.toDouble()) T> foo(/*0*/ x: T): kotlin.Unit
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ internal class DescriptorRendererImpl(
|
||||
private fun renderDefaultType(type: KotlinType): String {
|
||||
val sb = StringBuilder()
|
||||
|
||||
renderAnnotations(type, sb, /* needBrackets = */ true)
|
||||
renderAnnotations(type, sb)
|
||||
|
||||
if (type.isError) {
|
||||
sb.append(type.constructor.toString()) // Debug name of an error type is more informative
|
||||
@@ -366,7 +366,7 @@ internal class DescriptorRendererImpl(
|
||||
builder.append(if (fqName.isRoot) "root package" else renderFqName(fqName))
|
||||
}
|
||||
}
|
||||
private fun renderAnnotations(annotated: Annotated, builder: StringBuilder, needBrackets: Boolean = false) {
|
||||
private fun renderAnnotations(annotated: Annotated, builder: StringBuilder) {
|
||||
if (DescriptorRendererModifier.ANNOTATIONS !in modifiers) return
|
||||
|
||||
val excluded = if (annotated is KotlinType) excludedTypeAnnotationClasses else excludedAnnotationClasses
|
||||
@@ -537,6 +537,9 @@ internal class DescriptorRendererImpl(
|
||||
if (!variance.isEmpty()) {
|
||||
builder.append(renderKeyword(variance)).append(" ")
|
||||
}
|
||||
|
||||
renderAnnotations(typeParameter, builder)
|
||||
|
||||
renderName(typeParameter, builder)
|
||||
val upperBoundsCount = typeParameter.upperBounds.size
|
||||
if ((upperBoundsCount > 1 && !topLevel) || upperBoundsCount == 1) {
|
||||
@@ -846,7 +849,7 @@ internal class DescriptorRendererImpl(
|
||||
val primaryConstructor = klass.unsubstitutedPrimaryConstructor
|
||||
if (primaryConstructor != null) {
|
||||
builder.append(" ")
|
||||
renderAnnotations(primaryConstructor, builder, true)
|
||||
renderAnnotations(primaryConstructor, builder)
|
||||
renderVisibility(primaryConstructor.visibility, builder)
|
||||
builder.append("constructor")
|
||||
renderValueParameters(primaryConstructor.valueParameters, primaryConstructor.hasSynthesizedParameterNames(), builder)
|
||||
|
||||
Reference in New Issue
Block a user