KT-15677 KT-15775
Update parser & descriptor renderer to handle parenthesized types and function types properly. Resolve annotations in parenthesized types. AnnotationsImpl.isEmpty() returned false for targeted annotations only (e.g., 'fun @receiver:Ann C?.foo()'). Properly keep track of targeted annotations.
This commit is contained in:
+2
-2
@@ -12,7 +12,7 @@ fun inParamNested(fn1: (fn2: (<!UNSUPPORTED!>@Ann<!> n: Int)->Unit)->Unit) {}
|
||||
|
||||
fun inReturn(): (<!UNSUPPORTED!>@Ann<!> x: Int)->Unit = {}
|
||||
|
||||
class A : (@<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!> Int)->Unit {
|
||||
class A : (@Ann Int)->Unit {
|
||||
override fun invoke(p1: Int) {
|
||||
var lambda: (<!UNSUPPORTED!>@Ann<!> x: Int)->Unit = {}
|
||||
}
|
||||
@@ -24,6 +24,6 @@ class A : (@<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!> Int)->Unit {
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class TypeAnn
|
||||
|
||||
val onType: (@TypeAnn A).(<!UNSUPPORTED!>@Ann<!> a: @TypeAnn A, @<!DEBUG_INFO_MISSING_UNRESOLVED!>TypeAnn<!> A)->@TypeAnn A? = <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>{<!> null }
|
||||
val onType: (@TypeAnn A).(<!UNSUPPORTED!>@Ann<!> a: @TypeAnn A, @TypeAnn A)->@TypeAnn A? = <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>{<!> null }
|
||||
|
||||
fun (@TypeAnn A).extFun(@Ann a: @TypeAnn A): @TypeAnn A? = null
|
||||
+2
-2
@@ -1,14 +1,14 @@
|
||||
package
|
||||
|
||||
public val inVal: (x: kotlin.Int) -> kotlin.Unit
|
||||
public val onType: (@TypeAnn A).(a: @TypeAnn A, A) -> @TypeAnn A?
|
||||
public val onType: (@TypeAnn A).(a: @TypeAnn A, @TypeAnn A) -> @TypeAnn A?
|
||||
public fun f(/*0*/ @Ann x: kotlin.Int): kotlin.Unit
|
||||
public fun inParam(/*0*/ fn: (x: kotlin.Int) -> kotlin.Unit): kotlin.Unit
|
||||
public fun inParamNested(/*0*/ fn1: (fn2: (n: kotlin.Int) -> kotlin.Unit) -> kotlin.Unit): kotlin.Unit
|
||||
public fun inReturn(): (x: kotlin.Int) -> kotlin.Unit
|
||||
public fun @TypeAnn A.extFun(/*0*/ @Ann a: @TypeAnn A): @TypeAnn A?
|
||||
|
||||
public final class A : (kotlin.Int) -> kotlin.Unit {
|
||||
public final class A : (@Ann kotlin.Int) -> kotlin.Unit {
|
||||
public constructor A()
|
||||
public final val prop: (x: kotlin.Int) -> kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ annotation class special
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class base
|
||||
|
||||
fun transform(i: Int, tr: (@<!DEBUG_INFO_MISSING_UNRESOLVED!>special<!> Int) -> Int): Int = @special tr(@special i)
|
||||
fun transform(i: Int, tr: (<!WRONG_ANNOTATION_TARGET!>@special<!> Int) -> Int): Int = @special tr(@special i)
|
||||
|
||||
fun foo(i: Int): Int {
|
||||
val j = @special i + 1
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ i: kotlin.Int): kotlin.Int
|
||||
public fun transform(/*0*/ i: kotlin.Int, /*1*/ tr: (kotlin.Int) -> kotlin.Int): kotlin.Int
|
||||
public fun transform(/*0*/ i: kotlin.Int, /*1*/ tr: (@special kotlin.Int) -> kotlin.Int): kotlin.Int
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class base : kotlin.Annotation {
|
||||
public constructor base()
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
val test1: (suspend () -> Unit)? = null
|
||||
val test2: <!WRONG_MODIFIER_TARGET!>suspend<!> (() -> Unit)? = null
|
||||
val test3: <!WRONG_MODIFIER_TARGET!>suspend<!> ( (() -> Unit)? ) = null
|
||||
|
||||
fun foo() {
|
||||
test1?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
|
||||
test2?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
|
||||
test3?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public val test1: (suspend () -> kotlin.Unit)? = null
|
||||
public val test2: (suspend () -> kotlin.Unit)? = null
|
||||
public val test3: (suspend () -> kotlin.Unit)? = null
|
||||
public fun foo(): kotlin.Unit
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface AnnotationsOnNullableParenthesizedTypes {
|
||||
fun B<(@A C)?>.receiverArgument() {}
|
||||
|
||||
fun parameter(a: (@A C)?) {}
|
||||
|
||||
fun parameterArgument(a: B<(@A C)?>) {}
|
||||
|
||||
fun returnValue(): (@A C)?
|
||||
|
||||
fun <T> returnTypeParameterValue(): (@A T)?
|
||||
|
||||
fun returnArgument(): B<(@A C)?>
|
||||
|
||||
val lambdaType: (@A() (() -> C))?
|
||||
|
||||
val lambdaParameter: ((@A C)?) -> C
|
||||
|
||||
val lambdaReturnValue: () -> (@A C)?
|
||||
|
||||
val lambdaReceiver: (@A C)?.() -> C
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class A
|
||||
|
||||
interface B<T>
|
||||
interface C
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
package
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class A : kotlin.Annotation {
|
||||
public constructor A()
|
||||
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
|
||||
}
|
||||
|
||||
public interface AnnotationsOnNullableParenthesizedTypes {
|
||||
public abstract val lambdaParameter: (@A C?) -> C
|
||||
public abstract val lambdaReceiver: (@A C?).() -> C
|
||||
public abstract val lambdaReturnValue: () -> @A C?
|
||||
public abstract val lambdaType: @A() (() -> C)?
|
||||
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 fun parameter(/*0*/ a: @A C?): kotlin.Unit
|
||||
public open fun parameterArgument(/*0*/ a: B<@A C?>): kotlin.Unit
|
||||
public abstract fun returnArgument(): B<@A C?>
|
||||
public abstract fun </*0*/ T> returnTypeParameterValue(): @A T?
|
||||
public abstract fun returnValue(): @A C?
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public open fun B<@A C?>.receiverArgument(): kotlin.Unit
|
||||
}
|
||||
|
||||
public interface B</*0*/ T> {
|
||||
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
|
||||
}
|
||||
|
||||
public interface C {
|
||||
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
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface AnnotationsOnParenthesizedTypes {
|
||||
fun B<(@A C)>.receiverArgument() {}
|
||||
|
||||
fun parameter(a: (@A C)) {}
|
||||
|
||||
fun parameterArgument(a: B<(@A C)>) {}
|
||||
|
||||
fun returnValue(): (@A C)
|
||||
|
||||
fun <T> returnTypeParameterValue(): (@A T)
|
||||
|
||||
fun returnArgument(): B<(@A C)>
|
||||
|
||||
val lambdaType: (@A() (() -> C))
|
||||
|
||||
val lambdaParameter: ((@A C)) -> C
|
||||
|
||||
val lambdaReturnValue: () -> (@A C)
|
||||
|
||||
val lambdaReceiver: (@A C).() -> C
|
||||
|
||||
val lambdaParameterNP: (@A C) -> C
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class A
|
||||
|
||||
interface B<T>
|
||||
interface C
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class A : kotlin.Annotation {
|
||||
public constructor A()
|
||||
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
|
||||
}
|
||||
|
||||
public interface AnnotationsOnParenthesizedTypes {
|
||||
public abstract val lambdaParameter: (@A C) -> C
|
||||
public abstract val lambdaParameterNP: (@A C) -> C
|
||||
public abstract val lambdaReceiver: (@A C).() -> C
|
||||
public abstract val lambdaReturnValue: () -> @A C
|
||||
public abstract val lambdaType: @A() () -> C
|
||||
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 fun parameter(/*0*/ a: @A C): kotlin.Unit
|
||||
public open fun parameterArgument(/*0*/ a: B<@A C>): kotlin.Unit
|
||||
public abstract fun returnArgument(): B<@A C>
|
||||
public abstract fun </*0*/ T> returnTypeParameterValue(): @A T
|
||||
public abstract fun returnValue(): @A C
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public open fun B<@A C>.receiverArgument(): kotlin.Unit
|
||||
}
|
||||
|
||||
public interface B</*0*/ T> {
|
||||
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
|
||||
}
|
||||
|
||||
public interface C {
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class A
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class B
|
||||
|
||||
typealias Test0 = @A @B Int
|
||||
typealias Test1 = @A() (<!MODIFIER_LIST_NOT_ALLOWED!>@A<!> Int)
|
||||
typealias Test2 = @A() (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int)
|
||||
typealias Test3 = @A() (@A Int) -> Int
|
||||
typealias Test4 = @A() (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int)?
|
||||
typealias Test5 = @A() ( (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int)? )
|
||||
typealias Test6 = (@A @B Int)
|
||||
typealias Test7 = (@A @B Int)?
|
||||
typealias Test8 = (@A() (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int)? )
|
||||
typealias Test9 = (@A() (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int) )?
|
||||
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class A : kotlin.Annotation {
|
||||
public constructor A()
|
||||
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
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class B : kotlin.Annotation {
|
||||
public constructor B()
|
||||
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
|
||||
}
|
||||
public typealias Test0 = @A @B kotlin.Int
|
||||
public typealias Test1 = @A @A kotlin.Int
|
||||
public typealias Test2 = @A @B kotlin.Int
|
||||
public typealias Test3 = @A() (@A kotlin.Int) -> kotlin.Int
|
||||
public typealias Test4 = @A @B kotlin.Int?
|
||||
public typealias Test5 = @A @B kotlin.Int?
|
||||
public typealias Test6 = @A @B kotlin.Int
|
||||
public typealias Test7 = @A @B kotlin.Int?
|
||||
public typealias Test8 = @A @B kotlin.Int?
|
||||
public typealias Test9 = @A @B kotlin.Int?
|
||||
Reference in New Issue
Block a user