Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/inline/synchronizedOnSuspend.fir.kt
T
Ilmir Usmanov 92fac304e7 Forbid @Synchronized annotation on suspend functions
and lambdas. With warning for now.
 #KT-27333
2021-08-30 13:47:34 +02:00

25 lines
650 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
// SKIP_TXT
@Synchronized
suspend fun foo(f: () -> Unit): Unit = f()
fun builder(c: suspend () -> Unit) {}
val a: suspend () -> Unit
get() = @Synchronized {}
val b: suspend () -> Unit = @Synchronized {}
val c = builder (@Synchronized {})
val d = suspend @Synchronized {}
val e = <!WRONG_ANNOTATION_TARGET!>@Synchronized<!> suspend {}
fun test() {
@Synchronized
suspend fun foo(f: () -> Unit): Unit = f()
val b: suspend () -> Unit = @Synchronized {}
val c = builder (@Synchronized {})
val d = suspend @Synchronized {}
val e = <!WRONG_ANNOTATION_TARGET!>@Synchronized<!> suspend {}
}