7515efc52c
Related to KT-59369, KT-59390
43 lines
855 B
Kotlin
Vendored
43 lines
855 B
Kotlin
Vendored
// ISSUE: KT-53740
|
|
|
|
// IGNORE_LIGHT_ANALYSIS
|
|
// IGNORE_BACKEND: ANY
|
|
// REASON: red code (see corresponding diagnostic test)
|
|
|
|
fun box(): String {
|
|
parallelBuild(
|
|
{
|
|
setTypeVariable(TargetType())
|
|
},
|
|
{
|
|
consumeDifferentType(getTypeVariable())
|
|
}
|
|
)
|
|
return "OK"
|
|
}
|
|
|
|
|
|
|
|
|
|
class TargetType
|
|
class DifferentType
|
|
|
|
fun consumeDifferentType(value: DifferentType) {}
|
|
|
|
class Buildee<TV> {
|
|
fun setTypeVariable(value: TV) { storage = value }
|
|
fun getTypeVariable(): TV = storage
|
|
private var storage: TV = TargetType() as TV
|
|
}
|
|
|
|
fun <PTV> parallelBuild(
|
|
instructionsA: Buildee<PTV>.(PTV) -> Unit,
|
|
instructionsB: Buildee<PTV>.(PTV) -> Unit
|
|
): Buildee<PTV> {
|
|
val value = TargetType() as PTV
|
|
return Buildee<PTV>().apply {
|
|
instructionsA(value)
|
|
instructionsB(value)
|
|
}
|
|
}
|