[tests] Add test data for KT-49160

This commit is contained in:
Stanislav Ruban
2023-11-30 22:03:02 +01:00
committed by Space Team
parent cef44cfa7d
commit 2a257091fb
15 changed files with 500 additions and 0 deletions
@@ -0,0 +1,33 @@
// ISSUE: KT-49160
// IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test)
fun box(): String {
build outerBuild@ {
class LocalClass {
fun localClassMember() {
build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
}
}
}
return "OK"
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = TargetType() as TV
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,33 @@
// ISSUE: KT-49160
// IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test)
fun box(): String {
build outerBuild@ {
object {
fun anonymousObjectMember() {
build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
}
}
}
return "OK"
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = TargetType() as TV
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,31 @@
// ISSUE: KT-49160
// IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test)
fun box(): String {
build outerBuild@ {
fun localFunction() {
build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
}
}
return "OK"
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
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-49160
// IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test)
fun box(): String {
build outerBuild@ {
build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
}
return "OK"
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = TargetType() as TV
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,32 @@
// ISSUE: KT-49160
// IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test)
fun box(): String {
build outerBuild@ {
build middleBuild@ {
build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@middleBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
}
}
return "OK"
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = TargetType() as TV
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}