[tests] Add test data for KT-47989
This commit is contained in:
committed by
Space Team
parent
83117fa464
commit
cef44cfa7d
@@ -0,0 +1,32 @@
|
||||
// ISSUE: KT-47989
|
||||
|
||||
// IGNORE_LIGHT_ANALYSIS
|
||||
// IGNORE_BACKEND: ANY
|
||||
// REASON: red code (see corresponding diagnostic test)
|
||||
|
||||
fun box(): String {
|
||||
build {
|
||||
object: TypeSourceInterface {
|
||||
override fun produceTargetType() = getTypeVariable()
|
||||
}
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class TargetType
|
||||
|
||||
interface TypeSourceInterface {
|
||||
fun produceTargetType(): TargetType
|
||||
}
|
||||
|
||||
class Buildee<TV> {
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// ISSUE: KT-47989
|
||||
|
||||
// IGNORE_LIGHT_ANALYSIS
|
||||
// IGNORE_BACKEND: ANY
|
||||
// REASON: red code (see corresponding diagnostic test)
|
||||
|
||||
fun box(): String {
|
||||
build {
|
||||
object: TypeSourceInterface {
|
||||
override fun produceTargetTypeBuildee() = this@build
|
||||
}
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class TargetType
|
||||
|
||||
interface TypeSourceInterface {
|
||||
fun produceTargetTypeBuildee(): Buildee<TargetType>
|
||||
}
|
||||
|
||||
class Buildee<TV>
|
||||
|
||||
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||
return Buildee<PTV>().apply(instructions)
|
||||
}
|
||||
Reference in New Issue
Block a user