36 lines
681 B
Kotlin
Vendored
36 lines
681 B
Kotlin
Vendored
// FIR_IDENTICAL
|
|
// ALLOW_KOTLIN_PACKAGE
|
|
// !LANGUAGE: +UnrestrictedBuilderInference
|
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
|
|
// FILE: annotation.kt
|
|
|
|
package kotlin
|
|
|
|
annotation class BuilderInference
|
|
|
|
// FILE: test.kt
|
|
|
|
class GenericController<T> {
|
|
suspend fun yield(t: T) {}
|
|
}
|
|
|
|
suspend fun <S> GenericController<S>.extensionYield(s: S) {}
|
|
|
|
@BuilderInference
|
|
suspend fun <S> GenericController<S>.safeExtensionYield(s: S) {}
|
|
|
|
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
|
|
|
val normal = generate {
|
|
yield(42)
|
|
}
|
|
|
|
val extension = generate {
|
|
extensionYield("foo")
|
|
}
|
|
|
|
val safeExtension = generate {
|
|
safeExtensionYield("foo")
|
|
}
|