[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)
}
@@ -0,0 +1,35 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
class LocalClass {
fun localClassMember() {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
}
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>checkExactType<!><<!CANNOT_INFER_PARAMETER_TYPE!>Buildee<TargetType><!>>(outerBuildee)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,35 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
class LocalClass {
fun localClassMember() {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
}
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>outerBuildee<!>)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,35 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
object {
fun anonymousObjectMember() {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
}
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>checkExactType<!><<!CANNOT_INFER_PARAMETER_TYPE!>Buildee<TargetType><!>>(outerBuildee)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,35 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
object {
fun anonymousObjectMember() {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
}
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>outerBuildee<!>)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,33 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
fun localFunction() {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>checkExactType<!><<!CANNOT_INFER_PARAMETER_TYPE!>Buildee<TargetType><!>>(outerBuildee)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,33 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
fun localFunction() {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>outerBuildee<!>)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,31 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>checkExactType<!><<!CANNOT_INFER_PARAMETER_TYPE!>Buildee<TargetType><!>>(outerBuildee)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,31 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>outerBuildee<!>)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,37 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
val middleBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> middleBuild@ {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@middleBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>checkExactType<!><<!CANNOT_INFER_PARAMETER_TYPE!>Buildee<TargetType><!>>(middleBuildee)
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>checkExactType<!><<!CANNOT_INFER_PARAMETER_TYPE!>Buildee<TargetType><!>>(outerBuildee)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
@@ -0,0 +1,37 @@
// ISSUE: KT-49160
// CHECK_TYPE_WITH_EXACT
fun test() {
val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ {
val middleBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> middleBuild@ {
val innerBuildee = build innerBuild@ {
this@outerBuild.setTypeVariable(TargetType())
this@middleBuild.setTypeVariable(TargetType())
this@innerBuild.setTypeVariable(TargetType())
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(innerBuildee)
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>middleBuildee<!>)
}
// exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>outerBuildee<!>)
}
class TargetType
class Buildee<TV> {
fun setTypeVariable(value: TV) { storage = value }
private var storage: TV = null!!
}
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}