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

29 lines
548 B
Kotlin
Vendored

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