Files
kotlin-fork/compiler/testData/codegen/box/builderInference/issues/kt52838c.kt
T
Kirill Rakhman 251827c9aa [FIR] Don't approximate captured types
This fixes some type argument mismatch errors caused by a captured type
being approximated and then captured again.
Some places need to be adapted to work with captured types that
previously only worked with approximated types.

#KT-62959 Fixed
2024-01-17 08:20:05 +00:00

25 lines
449 B
Kotlin
Vendored

// ISSUE: KT-52838
// JVM_ABI_K1_K2_DIFF: KT-64738
fun box(): String {
build {
this as DerivedBuildee<*>
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)
}