Add tests for obsolete issues

#KT-32395 Obsolete (fixed in 42a5c488)
 #KT-32388 Obsolete (fixed in f3e4c9cd)
 #KT-32271 Obsolete (fixed in 60a0cf1)
This commit is contained in:
Mikhail Zarechenskiy
2019-07-03 14:27:18 +03:00
parent 675f01ee80
commit 6eefea6715
11 changed files with 169 additions and 0 deletions
@@ -0,0 +1,29 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
suspend fun <T> threadSafeSuspendCallback(startAsync: (CompletionLambda<T>) -> CancellationLambda): T = TODO()
typealias CompletionLambda<T> = (result: Result<T>) -> Unit
typealias CancellationLambda = () -> Unit
class Scope {
suspend fun <T> performAndWait(block: suspend CoroutineScope.() -> T): T {
return CoroutineWorker().run {
val result = threadSafeSuspendCallback<T> { completion ->
val workItem = WorkItem {
val result = runCatching {
block()
}
completion(result)
}
return@threadSafeSuspendCallback { Unit }
}
result
}
}
class WorkItem(
val block: suspend CoroutineScope.() -> Unit
)
}
class CoroutineWorker
interface CoroutineScope
@@ -0,0 +1,34 @@
package
public suspend fun </*0*/ T> threadSafeSuspendCallback(/*0*/ startAsync: (CompletionLambda<T> /* = (result: kotlin.Result<T>) -> kotlin.Unit */) -> CancellationLambda /* = () -> kotlin.Unit */): T
public interface CoroutineScope {
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 final class CoroutineWorker {
public constructor CoroutineWorker()
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 final class Scope {
public constructor Scope()
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 final suspend fun </*0*/ T> performAndWait(/*0*/ block: suspend CoroutineScope.() -> T): T
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class WorkItem {
public constructor WorkItem(/*0*/ block: suspend CoroutineScope.() -> kotlin.Unit)
public final val block: suspend CoroutineScope.() -> kotlin.Unit
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 CancellationLambda = () -> kotlin.Unit
public typealias CompletionLambda</*0*/ T> = (result: kotlin.Result<T>) -> kotlin.Unit
@@ -0,0 +1,26 @@
fun test1(ns: String?, vararg nullableStrs: String?) {
nullableStrs.contains("x")
nullableStrs.contains(ns)
"x" in nullableStrs
ns in nullableStrs
}
fun test2(ns: String?, vararg nonNullableStrs: String) {
nonNullableStrs.contains("x")
nonNullableStrs.contains(ns)
"x" in nonNullableStrs
ns in nonNullableStrs
}
fun test3(ns: String?, nullableStrs: Array<out String?>, nonNullableStrs: Array<out String>) {
nullableStrs.contains("x")
nonNullableStrs.contains("x")
nullableStrs.contains(ns)
nonNullableStrs.contains(ns)
"x" in nullableStrs
"x" in nonNullableStrs
ns in nullableStrs
ns in nonNullableStrs
}
@@ -0,0 +1,5 @@
package
public fun test1(/*0*/ ns: kotlin.String?, /*1*/ vararg nullableStrs: kotlin.String? /*kotlin.Array<out kotlin.String?>*/): kotlin.Unit
public fun test2(/*0*/ ns: kotlin.String?, /*1*/ vararg nonNullableStrs: kotlin.String /*kotlin.Array<out kotlin.String>*/): kotlin.Unit
public fun test3(/*0*/ ns: kotlin.String?, /*1*/ nullableStrs: kotlin.Array<out kotlin.String?>, /*2*/ nonNullableStrs: kotlin.Array<out kotlin.String>): kotlin.Unit