FIR checker: Report WRONG_MODIFIER_TARGET for suspend on

non-functional types.
This commit is contained in:
Mark Punzalan
2021-04-09 08:19:49 +00:00
committed by TeamCityServer
parent 9a4742c08d
commit b88913af1d
7 changed files with 76 additions and 13 deletions
@@ -6,12 +6,12 @@ interface SAM {
typealias Test1 = suspend () -> Unit
typealias Test2 = suspend Int.() -> Unit
typealias Test3 = suspend Function0<Unit>
typealias Test4 = suspend Action
typealias Test3 = <!WRONG_MODIFIER_TARGET!>suspend<!> Function0<Unit>
typealias Test4 = <!WRONG_MODIFIER_TARGET!>suspend<!> Action
typealias Test5 = List<suspend () -> Unit>
typealias Test6 = suspend List<() -> Unit>
typealias Test7 = suspend SAM
typealias Test8 = suspend kotlin.coroutines.SuspendFunction0<Unit>
typealias Test6 = <!WRONG_MODIFIER_TARGET!>suspend<!> List<() -> Unit>
typealias Test7 = <!WRONG_MODIFIER_TARGET!>suspend<!> SAM
typealias Test8 = <!WRONG_MODIFIER_TARGET!>suspend<!> kotlin.coroutines.SuspendFunction0<Unit>
typealias Test9 = suspend (() -> Unit) -> Unit
typealias Test10 = suspend (suspend () -> Unit) -> Unit
typealias Test11 = suspend () -> (suspend () -> Unit)
@@ -22,6 +22,7 @@ typealias Test15 = (@A() suspend () -> Unit)?
typealias Test16 = (@A suspend () -> Unit)?
typealias Test17 = @A suspend RS.() -> Unit
typealias Test18 = (suspend () -> Unit)?
typealias Test19 = (@A({ val x: <!WRONG_MODIFIER_TARGET!>suspend<!> String? = null; "" }()) suspend () -> Unit)?
interface Supertype1 : suspend () -> Unit {
@@ -32,6 +33,6 @@ interface Supertype2 : suspend String.() -> Unit {
}
@Target(AnnotationTarget.TYPE)
annotation class A
annotation class A(val value: String = "")
interface RS
@@ -22,6 +22,7 @@ typealias Test15 = (@A() suspend () -> Unit)?
typealias Test16 = (@A suspend () -> Unit)?
typealias Test17 = @A suspend RS.() -> Unit
typealias Test18 = (suspend () -> Unit)?
typealias Test19 = (@A(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>{ val x: <!WRONG_MODIFIER_TARGET, WRONG_MODIFIER_TARGET!>suspend<!> String? = null; "" }()<!>) suspend () -> Unit)?
interface Supertype1 : <!SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE!>suspend () -> Unit<!> {
@@ -32,6 +33,6 @@ interface Supertype2 : <!SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE!>suspend String.() -
}
@Target(AnnotationTarget.TYPE)
annotation class A
annotation class A(val value: String = "")
interface RS
@@ -1,7 +1,8 @@
package
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class A : kotlin.Annotation {
public constructor A()
public constructor A(/*0*/ value: kotlin.String = ...)
public final val value: kotlin.String
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
@@ -44,6 +45,7 @@ public typealias Test15 = (@A suspend () -> kotlin.Unit)?
public typealias Test16 = (@A suspend () -> kotlin.Unit)?
public typealias Test17 = (@A suspend RS.() -> kotlin.Unit)
public typealias Test18 = (suspend () -> kotlin.Unit)?
public typealias Test19 = (@A suspend () -> kotlin.Unit)?
public typealias Test2 = suspend kotlin.Int.() -> kotlin.Unit
public typealias Test3 = () -> kotlin.Unit
public typealias Test4 = Action
@@ -1,6 +1,6 @@
val test1: (suspend () -> Unit)? = null
val test2: suspend (() -> Unit)? = null
val test3: suspend ( (() -> Unit)? ) = null
val test2: <!WRONG_MODIFIER_TARGET!>suspend<!> (() -> Unit)? = null
val test3: <!WRONG_MODIFIER_TARGET!>suspend<!> ( (() -> Unit)? ) = null
fun foo() {
test1?.invoke()