[tests] Change builder inference tests in accordance with KT-53749 changes

This commit is contained in:
Mikhail Glukhikh
2023-12-05 10:36:22 +01:00
committed by Space Team
parent 7515efc52c
commit 254bcdc80a
21 changed files with 33 additions and 57 deletions
@@ -1,12 +1,9 @@
// ISSUE: KT-50453 // ISSUE: KT-50453
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
// IGNORE_BACKEND_K2: JVM_IR, WASM
// REASON: run-time failure (java.lang.ClassCastException: TargetType cannot be cast to DifferentType @ Kt50453Kt$box$1.invoke)
fun box(): String { fun box(): String {
build { build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
@@ -1,12 +1,9 @@
// ISSUE: KT-54664 // ISSUE: KT-54664
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
// IGNORE_BACKEND_K2: JVM_IR, WASM
// REASON: run-time failure (java.lang.ClassCastException: TargetType cannot be cast to DifferentType @ Kt54664Kt.consumeDifferentTypeCallable)
fun box(): String { fun box(): String {
build { build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
@@ -1,12 +1,9 @@
// ISSUE: KT-55056 // ISSUE: KT-55056
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
// IGNORE_BACKEND_K2: JVM_IR, WASM
// REASON: run-time failure (java.lang.ClassCastException: TargetType cannot be cast to DifferentType @ Kt55056Kt$box$1.invoke)
fun box(): String { fun box(): String {
build { build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
@@ -1,12 +1,9 @@
// ISSUE: KT-56949 // ISSUE: KT-56949
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
// IGNORE_BACKEND_K2: JVM_IR, WASM
// REASON: run-time failure (java.lang.ClassCastException: TargetType cannot be cast to DifferentType @ Kt56949Kt$box$1.invoke)
fun box(): String { fun box(): String {
build { build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
@@ -1,7 +1,7 @@
// ISSUE: KT-57707 // ISSUE: KT-57707
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
fun box(): String { fun box(): String {
@@ -1,12 +1,9 @@
// ISSUE: KT-59426 // ISSUE: KT-59426
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
// IGNORE_BACKEND_K2: JVM_IR, WASM
// REASON: run-time failure (java.lang.ClassCastException: DifferentType cannot be cast to TargetType @ Kt59426Kt.consumeBuildeeReceiver)
fun box(): String { fun box(): String {
build { build {
setTypeVariable(DifferentType()) setTypeVariable(DifferentType())
@@ -2,12 +2,9 @@
// WITH_STDLIB // WITH_STDLIB
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
// IGNORE_BACKEND_K2: JVM_IR, WASM
// REASON: run-time failure (java.lang.ArrayStoreException: TargetType @ Kt63840aKt$box$1.invoke)
fun box(): String { fun box(): String {
build { build {
select( select(
@@ -1,12 +1,9 @@
// ISSUE: KT-63840 // ISSUE: KT-63840
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
// IGNORE_BACKEND_K2: JVM_IR
// REASON: run-time failure (java.lang.ClassCastException: TargetType cannot be cast to DifferentType @ Kt63840bKt$box$1.invoke)
fun box(): String { fun box(): String {
build { build {
if (true) if (true)
@@ -1,12 +1,9 @@
// ISSUE: KT-63840 // ISSUE: KT-63840
// IGNORE_LIGHT_ANALYSIS // IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test) // REASON: red code (see corresponding diagnostic test)
// IGNORE_BACKEND_K2: JVM_IR
// REASON: run-time failure (java.lang.ClassCastException: TargetType cannot be cast to DifferentType @ Kt63840cKt$box$1.invoke)
fun box(): String { fun box(): String {
build { build {
when { when {
@@ -4,7 +4,7 @@
fun test() { fun test() {
val buildee = build { val buildee = build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
consume(getTypeVariable()) consume(<!ARGUMENT_TYPE_MISMATCH!>getTypeVariable()<!>)
} }
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
@@ -4,7 +4,7 @@
fun test() { fun test() {
val buildee = build { val buildee = build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
consumeDifferentTypeCallable(this::getTypeVariable) consumeDifferentTypeCallable(<!ARGUMENT_TYPE_MISMATCH!>this::getTypeVariable<!>)
} }
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT // CHECK_TYPE_WITH_EXACT
fun test() { fun test() {
val buildee = build { val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
consumeDifferentType(extensionReplaceOutProjectedTypeVariable(DifferentType())) consumeDifferentType(extensionReplaceOutProjectedTypeVariable(DifferentType()))
} }<!>
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(buildee) checkExactType<Buildee<TargetType>>(buildee)
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT // CHECK_TYPE_WITH_EXACT
fun test() { fun test() {
val buildee = build { val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
consumeDifferentTypeSubtype(getTypeVariable()) consumeDifferentTypeSubtype(getTypeVariable())
} }<!>
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(buildee) checkExactType<Buildee<TargetType>>(buildee)
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT // CHECK_TYPE_WITH_EXACT
fun test() { fun test() {
val buildee = build { val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
extensionSetOutProjectedTypeVariable(DifferentType()) extensionSetOutProjectedTypeVariable(DifferentType())
} }<!>
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(buildee) checkExactType<Buildee<TargetType>>(buildee)
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT // CHECK_TYPE_WITH_EXACT
fun test() { fun test() {
val buildee = build { val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(DifferentType()) setTypeVariable(DifferentType())
consumeBuildeeReceiver() consumeBuildeeReceiver()
} }<!>
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(buildee) checkExactType<Buildee<TargetType>>(buildee)
@@ -31,4 +31,4 @@ fun Buildee<TargetType>.consumeBuildeeReceiver() {
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> { fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions) return Buildee<PTV>().apply(instructions)
} }
@@ -2,9 +2,9 @@
// CHECK_TYPE_WITH_EXACT // CHECK_TYPE_WITH_EXACT
fun test() { fun test() {
val buildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> { val buildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
if (true) { if (true) {
setTypeVariable(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>GenericBox<!>()) setTypeVariable(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>GenericBox<!>())
} else { } else {
setTypeVariable(GenericBox<TargetType>()) setTypeVariable(GenericBox<TargetType>())
} }
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT // CHECK_TYPE_WITH_EXACT
fun test() { fun test() {
val buildee = build { val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(TargetType()) setTypeVariable(TargetType())
<!BUILDER_INFERENCE_STUB_RECEIVER!>getTypeVariable().consumeDifferentTypeReceiver()<!> <!BUILDER_INFERENCE_STUB_RECEIVER!>getTypeVariable().consumeDifferentTypeReceiver()<!>
} }<!>
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(buildee) checkExactType<Buildee<TargetType>>(buildee)
@@ -8,10 +8,10 @@ fun test() {
setBoundedTypeVariable(TargetType()) setBoundedTypeVariable(TargetType())
setBoundedTypeVariable(DifferentType()) setBoundedTypeVariable(DifferentType())
} }
val buildee = <!NEW_INFERENCE_ERROR!>boundedBuild { val buildee = boundedBuild {
setBoundedTypeVariable(TargetType()) setBoundedTypeVariable(TargetType())
setBoundedTypeVariable(DifferentType()) setBoundedTypeVariable(<!ARGUMENT_TYPE_MISMATCH!>DifferentType()<!>)
}<!> }
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<BoundedBuildee<TargetType>>(<!ARGUMENT_TYPE_MISMATCH("BoundedBuildee<TargetType>; BoundedBuildee<kotlin.Any>")!>buildee<!>) checkExactType<BoundedBuildee<TargetType>>(<!ARGUMENT_TYPE_MISMATCH("BoundedBuildee<TargetType>; BoundedBuildee<kotlin.Any>")!>buildee<!>)
@@ -3,12 +3,12 @@
// WITH_STDLIB // WITH_STDLIB
fun test() { fun test() {
val buildee = build { val buildee = <!NEW_INFERENCE_ERROR!>build {
select( select(
replaceTypeVariable(TargetType()), replaceTypeVariable(TargetType()),
DifferentType() DifferentType()
) )
} }<!>
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(buildee) checkExactType<Buildee<TargetType>>(buildee)
@@ -2,12 +2,12 @@
// CHECK_TYPE_WITH_EXACT // CHECK_TYPE_WITH_EXACT
fun test() { fun test() {
val buildee = build { val buildee = <!NEW_INFERENCE_ERROR!>build {
if (true) if (true)
replaceTypeVariable(TargetType()) replaceTypeVariable(TargetType())
else else
DifferentType() DifferentType()
} }<!>
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(buildee) checkExactType<Buildee<TargetType>>(buildee)
@@ -2,12 +2,12 @@
// CHECK_TYPE_WITH_EXACT // CHECK_TYPE_WITH_EXACT
fun test() { fun test() {
val buildee = build { val buildee = <!NEW_INFERENCE_ERROR!>build {
when { when {
true -> replaceTypeVariable(TargetType()) true -> replaceTypeVariable(TargetType())
else -> DifferentType() else -> DifferentType()
} }
} }<!>
// exact type equality check — turns unexpected compile-time behavior into red code // 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 // considered to be non-user-reproducible code for the purposes of these tests
checkExactType<Buildee<TargetType>>(buildee) checkExactType<Buildee<TargetType>>(buildee)