[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
@@ -4,7 +4,7 @@
fun test() {
val buildee = build {
setTypeVariable(TargetType())
consume(getTypeVariable())
consume(<!ARGUMENT_TYPE_MISMATCH!>getTypeVariable()<!>)
}
// 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
@@ -4,7 +4,7 @@
fun test() {
val buildee = build {
setTypeVariable(TargetType())
consumeDifferentTypeCallable(this::getTypeVariable)
consumeDifferentTypeCallable(<!ARGUMENT_TYPE_MISMATCH!>this::getTypeVariable<!>)
}
// 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
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT
fun test() {
val buildee = build {
val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(TargetType())
consumeDifferentType(extensionReplaceOutProjectedTypeVariable(DifferentType()))
}
}<!>
// 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>>(buildee)
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT
fun test() {
val buildee = build {
val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(TargetType())
consumeDifferentTypeSubtype(getTypeVariable())
}
}<!>
// 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>>(buildee)
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT
fun test() {
val buildee = build {
val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(TargetType())
extensionSetOutProjectedTypeVariable(DifferentType())
}
}<!>
// 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>>(buildee)
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT
fun test() {
val buildee = build {
val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(DifferentType())
consumeBuildeeReceiver()
}
}<!>
// 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>>(buildee)
@@ -31,4 +31,4 @@ fun Buildee<TargetType>.consumeBuildeeReceiver() {
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply(instructions)
}
}
@@ -2,9 +2,9 @@
// CHECK_TYPE_WITH_EXACT
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) {
setTypeVariable(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>GenericBox<!>())
setTypeVariable(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>GenericBox<!>())
} else {
setTypeVariable(GenericBox<TargetType>())
}
@@ -2,10 +2,10 @@
// CHECK_TYPE_WITH_EXACT
fun test() {
val buildee = build {
val buildee = <!NEW_INFERENCE_ERROR!>build {
setTypeVariable(TargetType())
<!BUILDER_INFERENCE_STUB_RECEIVER!>getTypeVariable().consumeDifferentTypeReceiver()<!>
}
}<!>
// 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>>(buildee)
@@ -8,10 +8,10 @@ fun test() {
setBoundedTypeVariable(TargetType())
setBoundedTypeVariable(DifferentType())
}
val buildee = <!NEW_INFERENCE_ERROR!>boundedBuild {
val buildee = boundedBuild {
setBoundedTypeVariable(TargetType())
setBoundedTypeVariable(DifferentType())
}<!>
setBoundedTypeVariable(<!ARGUMENT_TYPE_MISMATCH!>DifferentType()<!>)
}
// 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<BoundedBuildee<TargetType>>(<!ARGUMENT_TYPE_MISMATCH("BoundedBuildee<TargetType>; BoundedBuildee<kotlin.Any>")!>buildee<!>)
@@ -3,12 +3,12 @@
// WITH_STDLIB
fun test() {
val buildee = build {
val buildee = <!NEW_INFERENCE_ERROR!>build {
select(
replaceTypeVariable(TargetType()),
DifferentType()
)
}
}<!>
// 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>>(buildee)
@@ -2,12 +2,12 @@
// CHECK_TYPE_WITH_EXACT
fun test() {
val buildee = build {
val buildee = <!NEW_INFERENCE_ERROR!>build {
if (true)
replaceTypeVariable(TargetType())
else
DifferentType()
}
}<!>
// 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>>(buildee)
@@ -2,12 +2,12 @@
// CHECK_TYPE_WITH_EXACT
fun test() {
val buildee = build {
val buildee = <!NEW_INFERENCE_ERROR!>build {
when {
true -> replaceTypeVariable(TargetType())
else -> DifferentType()
}
}
}<!>
// 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>>(buildee)