[tests] Change builder inference tests in accordance with new K2 BI diagnostics
Related to KT-59369, KT-59390
This commit is contained in:
committed by
Space Team
parent
da0c3090a9
commit
7515efc52c
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
// IGNORE_LIGHT_ANALYSIS
|
// IGNORE_LIGHT_ANALYSIS
|
||||||
// IGNORE_BACKEND: ANY
|
// IGNORE_BACKEND: ANY
|
||||||
// REASON: red code in K1 (see corresponding diagnostic test)
|
// REASON: red code (see corresponding diagnostic test)
|
||||||
// REASON: compile-time failure in K2/JVM (java.lang.IllegalStateException: Cannot serialize error type: ERROR CLASS: Cannot infer argument for type parameter PTV)
|
|
||||||
// REASON: compile-time failure in K2/Native, K2/WASM, K2/JS (org.jetbrains.kotlin.backend.common.linkage.issues.IrDisallowedErrorNode: Class found but error nodes are not allowed)
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val buildee = initializeAndBuild(
|
val buildee = initializeAndBuild(
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
// ISSUE: KT-53740
|
// ISSUE: KT-53740
|
||||||
|
|
||||||
// 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 @ Kt53740aKt$box$2.invoke)
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
parallelBuild(
|
parallelBuild(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
// ISSUE: KT-53740
|
// ISSUE: KT-53740
|
||||||
|
|
||||||
// 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 @ Kt53740bKt$box$2.invoke)
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
parallelInOutBuild(
|
parallelInOutBuild(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ISSUE: KT-59798
|
// ISSUE: KT-59798
|
||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
|
|
||||||
// IGNORE_LIGHT_ANALYSIS
|
// IGNORE_LIGHT_ANALYSIS
|
||||||
// IGNORE_BACKEND: ANY
|
// IGNORE_BACKEND: ANY
|
||||||
// REASON: red code in K1 (see corresponding diagnostic test)
|
// REASON: red code (see corresponding diagnostic test)
|
||||||
// REASON: compile-time failure in K2/JVM (java.lang.IllegalStateException: Cannot serialize error type: ERROR CLASS: Cannot infer argument for type parameter PTV)
|
|
||||||
// REASON: compile-time failure in K2/Native, K2/WASM, K2/JS (org.jetbrains.kotlin.backend.common.linkage.issues.IrDisallowedErrorNode: Class found but error nodes are not allowed)
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
selectBuildee(
|
selectBuildee(
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
// ISSUE: KT-60291
|
// ISSUE: KT-60291
|
||||||
|
|
||||||
// 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: NATIVE, WASM, JS_IR, JS_IR_ES6
|
|
||||||
// REASON: compile-time failure (org.jetbrains.kotlin.backend.common.linkage.issues.IrDisallowedErrorNode: Class found but error nodes are not allowed)
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
if (true)
|
if (true)
|
||||||
build { setTypeVariable(TargetType()) }
|
build { setTypeVariable(TargetType()) }
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
// IGNORE_LIGHT_ANALYSIS
|
// IGNORE_LIGHT_ANALYSIS
|
||||||
// IGNORE_BACKEND: ANY
|
// IGNORE_BACKEND: ANY
|
||||||
// REASON: red code in K1 (see corresponding diagnostic test)
|
// REASON: red code (see corresponding diagnostic test)
|
||||||
// REASON: compile-time failure in K2/JVM (java.lang.IllegalStateException: Cannot serialize error type: ERROR CLASS: Cannot infer argument for type parameter PTV)
|
|
||||||
// REASON: compile-time failure in K2/Native, K2/WASM, K2/JS (org.jetbrains.kotlin.backend.common.linkage.issues.IrDisallowedErrorNode: Class found but error nodes are not allowed)
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
when ("") {
|
when ("") {
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
// ISSUE: KT-63648
|
// ISSUE: KT-63648
|
||||||
|
|
||||||
// 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 @ Kt63648Kt$box$1.invoke)
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
build {
|
build {
|
||||||
setTypeVariable(TargetType())
|
setTypeVariable(TargetType())
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
val buildee = build {
|
val buildee = build {
|
||||||
setTypeVariable(TargetType())
|
setTypeVariable(TargetType())
|
||||||
letForTypeVariable { it.<!OVERLOAD_RESOLUTION_AMBIGUITY!>extensionProduceConcreteType<!>() }
|
letForTypeVariable { it.<!NONE_APPLICABLE!>extensionProduceConcreteType<!>() }
|
||||||
}
|
}
|
||||||
// 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
-2
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val buildee = buildFromValue(
|
val buildee = buildFromValue(
|
||||||
innerBuild { setInnerTypeVariable(TargetType()) },
|
innerBuild <!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{ setInnerTypeVariable(TargetType()) }<!>,
|
||||||
{ it.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>placeholderExtensionInvokeOnInnerBuildee<!>() }
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{ <!BUILDER_INFERENCE_STUB_RECEIVER!>it.placeholderExtensionInvokeOnInnerBuildee()<!> }<!>
|
||||||
)
|
)
|
||||||
// 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
|
||||||
|
|||||||
+5
-5
@@ -3,17 +3,17 @@
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val buildee = stepByStepBuild(
|
val buildee = stepByStepBuild(
|
||||||
{
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{
|
||||||
it.<!UNRESOLVED_REFERENCE!>concreteTypeMemberProperty<!>
|
it.<!UNRESOLVED_REFERENCE!>concreteTypeMemberProperty<!>
|
||||||
TargetType()
|
TargetType()
|
||||||
},
|
}<!>,
|
||||||
{
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{
|
||||||
consumeTargetTypeBase(it)
|
consumeTargetTypeBase(it)
|
||||||
}
|
}<!>
|
||||||
)
|
)
|
||||||
// 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>>(<!ARGUMENT_TYPE_MISMATCH("Buildee<TargetType>; Buildee<TargetTypeBase>")!>buildee<!>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val buildee = parallelBuild(
|
val buildee = parallelBuild(
|
||||||
{
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{
|
||||||
consumeTargetTypeBase(it)
|
consumeTargetTypeBase(it)
|
||||||
},
|
}<!>,
|
||||||
{
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{
|
||||||
consumeTargetType(it)
|
consumeTargetType(it)
|
||||||
}
|
}<!>
|
||||||
)
|
)
|
||||||
// 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
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val buildee = initializeAndBuild(
|
val buildee = initializeAndBuild(
|
||||||
{ build { setTypeVariable(TargetType()) } },
|
{ build <!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{ setTypeVariable(TargetType()) }<!> },
|
||||||
{ placeholderExtensionInvokeOnBuildee() },
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{ placeholderExtensionInvokeOnBuildee() }<!>,
|
||||||
)
|
)
|
||||||
// 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
-4
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val buildee = parallelBuild(
|
val buildee = parallelBuild(
|
||||||
{
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{
|
||||||
setTypeVariable(TargetType())
|
setTypeVariable(TargetType())
|
||||||
},
|
}<!>,
|
||||||
{
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{
|
||||||
consumeDifferentType(getTypeVariable())
|
consumeDifferentType(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
-4
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val buildee = parallelInOutBuild(
|
val buildee = parallelInOutBuild(
|
||||||
{
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{
|
||||||
setInProjectedTypeVariable(TargetType())
|
setInProjectedTypeVariable(TargetType())
|
||||||
},
|
}<!>,
|
||||||
{
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>{
|
||||||
consumeDifferentType(getOutProjectedTypeVariable())
|
consumeDifferentType(getOutProjectedTypeVariable())
|
||||||
}
|
}<!>
|
||||||
)
|
)
|
||||||
// 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())
|
||||||
getTypeVariable().let {}
|
<!BUILDER_INFERENCE_STUB_RECEIVER!>getTypeVariable().let {}<!>
|
||||||
}
|
}
|
||||||
// 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
|
||||||
@@ -24,4 +24,4 @@ class Buildee<TV> {
|
|||||||
|
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
// ISSUE: KT-60291
|
|
||||||
// CHECK_TYPE_WITH_EXACT
|
|
||||||
// WITH_STDLIB
|
|
||||||
|
|
||||||
fun test() {
|
|
||||||
val buildee = selectBuildee(
|
|
||||||
build { setTypeVariable(TargetType()) },
|
|
||||||
build {}
|
|
||||||
)
|
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun <T> selectBuildee(vararg values: Buildee<T>): Buildee<T> = values.first()
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// ISSUE: KT-60291
|
// ISSUE: KT-60291
|
||||||
|
// FIR_IDENTICAL
|
||||||
// CHECK_TYPE_WITH_EXACT
|
// CHECK_TYPE_WITH_EXACT
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
// ISSUE: KT-60291
|
|
||||||
// CHECK_TYPE_WITH_EXACT
|
|
||||||
|
|
||||||
fun test() {
|
|
||||||
val buildee = if (true)
|
|
||||||
build { setTypeVariable(TargetType()) }
|
|
||||||
else
|
|
||||||
build {}
|
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// ISSUE: KT-60291
|
// ISSUE: KT-60291
|
||||||
|
// FIR_IDENTICAL
|
||||||
// CHECK_TYPE_WITH_EXACT
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
// ISSUE: KT-60291
|
|
||||||
// CHECK_TYPE_WITH_EXACT
|
|
||||||
|
|
||||||
fun test() {
|
|
||||||
val buildee = when ("") {
|
|
||||||
"true" -> build { setTypeVariable(TargetType()) }
|
|
||||||
"false" -> build {}
|
|
||||||
else -> Buildee()
|
|
||||||
}
|
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// ISSUE: KT-60291
|
// ISSUE: KT-60291
|
||||||
|
// FIR_IDENTICAL
|
||||||
// CHECK_TYPE_WITH_EXACT
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
val buildee = build {
|
val buildee = build {
|
||||||
setTypeVariable(TargetType())
|
setTypeVariable(TargetType())
|
||||||
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
|
||||||
@@ -27,4 +27,4 @@ class Buildee<TV> {
|
|||||||
|
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user