b9019d3de1
^KT-59791 In Progress
33 lines
657 B
Kotlin
Vendored
33 lines
657 B
Kotlin
Vendored
// ISSUE: KT-57834
|
|
|
|
// IGNORE_LIGHT_ANALYSIS
|
|
// IGNORE_BACKEND_K1: ANY
|
|
// REASON: red code (see corresponding diagnostic test)
|
|
|
|
fun box(): String {
|
|
build {
|
|
setTypeVariable(TargetType())
|
|
consume(getTypeVariable())
|
|
}
|
|
return "OK"
|
|
}
|
|
|
|
|
|
|
|
|
|
class TargetType
|
|
class DifferentType
|
|
|
|
fun consume(value: TargetType) {}
|
|
fun consume(value: DifferentType) {}
|
|
|
|
class Buildee<TV> {
|
|
fun setTypeVariable(value: TV) { storage = value }
|
|
fun getTypeVariable(): TV = storage
|
|
private var storage: TV = TargetType() as TV
|
|
}
|
|
|
|
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
|
return Buildee<PTV>().apply(instructions)
|
|
}
|