Support coroutine inference under version <= 1.2
Follow-up #KT-26958
This commit is contained in:
compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// !LANGUAGE: -ExperimentalBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Builder<T> {
|
||||
suspend fun add(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> build(g: suspend Builder<S>.() -> Unit): List<S> = TODO()
|
||||
fun <S> wrongBuild(g: Builder<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
fun <S> Builder<S>.extensionAdd(s: S) {}
|
||||
|
||||
suspend fun <S> Builder<S>.safeExtensionAdd(s: S) {}
|
||||
|
||||
val member = build {
|
||||
add(42)
|
||||
}
|
||||
|
||||
val memberWithoutAnn = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>wrongBuild<!> {
|
||||
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>add<!>(42)
|
||||
}
|
||||
|
||||
val extension = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
extensionAdd("foo")
|
||||
}
|
||||
|
||||
val safeExtension = build {
|
||||
safeExtensionAdd("foo")
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package
|
||||
|
||||
public val extension: [ERROR : Type for build {
|
||||
extensionAdd("foo")
|
||||
}]
|
||||
public val member: kotlin.collections.List<kotlin.Int>
|
||||
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
|
||||
add(42)
|
||||
}]
|
||||
public val safeExtension: kotlin.collections.List<kotlin.String>
|
||||
public fun </*0*/ S> build(/*0*/ g: suspend Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> wrongBuild(/*0*/ g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> Builder<S>.extensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
public suspend fun </*0*/ S> Builder<S>.safeExtensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
|
||||
public final class Builder</*0*/ T> {
|
||||
public constructor Builder</*0*/ T>()
|
||||
public final suspend fun add(/*0*/ t: T): 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
|
||||
}
|
||||
Reference in New Issue
Block a user