[tests] Add test data for KT-55281

This commit is contained in:
Stanislav Ruban
2023-12-02 15:26:57 +01:00
committed by Space Team
parent 6532eb4c60
commit 4021e022b7
3 changed files with 91 additions and 0 deletions
@@ -0,0 +1,31 @@
// 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)
}