Files
kotlin-fork/compiler/testData/codegen/box/builderInference/issues/kt55281.kt
T
2023-12-05 18:15:51 +00:00

32 lines
602 B
Kotlin
Vendored

// ISSUE: KT-55281
// IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K2: ANY
// REASON: red code (see corresponding diagnostic test)
fun box(): String {
build {
this as DerivedBuildee<*>
consumeNullableAny(getTypeVariable())
}
return "OK"
}
class TargetType
fun consumeNullableAny(value: Any?) {}
open class Buildee<TV> {
fun getTypeVariable(): TV = storage
private var storage: TV = null as TV
}
class DerivedBuildee<TA>: Buildee<TA>()
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return DerivedBuildee<PTV>().apply(instructions)
}