K2: Adjust test data after PCLA implementation [green-to-red, controversial]
^KT-59791 In Progress
This commit is contained in:
committed by
Space Team
parent
f945dce4c8
commit
8459465177
@@ -1,6 +1,7 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// WITH_STDLIB
|
||||
// JVM_ABI_K1_K2_DIFF: KT-61909
|
||||
// ISSUE: KT-61250
|
||||
// IGNORE_BACKEND_K2: ANY
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
@@ -42,4 +43,4 @@ fun box(): String {
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -1,4 +1,7 @@
|
||||
// WITH_STDLIB
|
||||
// IGNORE_BACKEND_K2: ANY
|
||||
// ISSUE: KT-64823 (K2/PCLA difference)
|
||||
// Also, see testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.kt
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
|
||||
Vendored
+3
-2
@@ -1,6 +1,7 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -DEPRECATION -UNCHECKED_CAST -OPT_IN_IS_NOT_ENABLED
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-61250 (for K2/PCLA difference)
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
@@ -33,7 +34,7 @@ fun main() {
|
||||
captureIn(getInv())
|
||||
|
||||
// K is fixed into CapturedType(out NotFixed: TypeVariable(R))
|
||||
capture(getOut())
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>capture<!>(<!ARGUMENT_TYPE_MISMATCH!>getOut()<!>)
|
||||
""
|
||||
}
|
||||
build {
|
||||
@@ -42,4 +43,4 @@ fun main() {
|
||||
capture(getIn())
|
||||
""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -DEPRECATION -UNCHECKED_CAST -OPT_IN_IS_NOT_ENABLED
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-61250 (for K2/PCLA difference)
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
+18
-17
@@ -1,6 +1,7 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -OPT_IN_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-64802 (K2/PCLA difference)
|
||||
|
||||
// FILE: Test.java
|
||||
|
||||
@@ -34,16 +35,16 @@ fun <E> select4(x: E?, y: In<E>): E = x!!
|
||||
fun test() {
|
||||
val ret = build {
|
||||
emit("1")
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select1(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select1(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select1(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select1(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select4(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select4(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select4(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select4(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*>? & java.io.Serializable?")!>select1(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*>? & java.io.Serializable?")!>select1(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*>? & java.io.Serializable?")!>select1(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*>? & java.io.Serializable?")!>select1(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*> & java.io.Serializable..kotlin.Comparable<*>? & java.io.Serializable?")!>select4(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*> & java.io.Serializable..kotlin.Comparable<*>? & java.io.Serializable?")!>select4(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*> & java.io.Serializable..kotlin.Comparable<*>? & java.io.Serializable?")!>select4(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*> & java.io.Serializable..kotlin.Comparable<*>? & java.io.Serializable?")!>select4(Test.foo(get()), getIn())<!>
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select4(id(Test.foo(get())), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*> & java.io.Serializable..kotlin.Comparable<*>? & java.io.Serializable?")!>select4(id(Test.foo(get())), getIn())<!>
|
||||
|
||||
build2 {
|
||||
emit(1)
|
||||
@@ -71,14 +72,14 @@ fun test() {
|
||||
}
|
||||
val ret2 = build {
|
||||
emit(if (true) "" else null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select2(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select2(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select2(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select2(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select3(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select3(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select3(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select3(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select2(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select2(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select2(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select2(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select3(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select3(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select3(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select3(Test.foo(get()), getIn())<!>
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -OPT_IN_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-64802 (K2/PCLA difference)
|
||||
|
||||
// FILE: Test.java
|
||||
|
||||
|
||||
+9
-8
@@ -1,6 +1,7 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -OPT_IN_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-64802 (K2/PCLA difference)
|
||||
|
||||
// FILE: Test.java
|
||||
|
||||
@@ -48,13 +49,13 @@ fun test() {
|
||||
build2 {
|
||||
emit(1)
|
||||
select1(this@build.get(), getInv())
|
||||
select1(get(), Test.foo(this@build.getInv()))
|
||||
select1(get(), <!ARGUMENT_TYPE_MISMATCH!>Test.foo(this@build.getInv())<!>)
|
||||
select1(Test.foo(this@build.get()), Test.foo(getInv()))
|
||||
select1(Test.foo(get()), this@build.getInv())
|
||||
select1(Test.foo(get()), <!ARGUMENT_TYPE_MISMATCH!>this@build.getInv()<!>)
|
||||
select4(this@build.get(), getInv())
|
||||
select4(get(), Test.foo(this@build.getInv()))
|
||||
select4(get(), <!ARGUMENT_TYPE_MISMATCH!>Test.foo(this@build.getInv())<!>)
|
||||
select4(Test.foo(this@build.get()), Test.foo(getInv()))
|
||||
select4(Test.foo(get()), this@build.getInv())
|
||||
select4(Test.foo(get()), <!ARGUMENT_TYPE_MISMATCH!>this@build.getInv()<!>)
|
||||
|
||||
select4(id(Test.foo(this@build.get())), getInv())
|
||||
""
|
||||
@@ -79,13 +80,13 @@ fun test() {
|
||||
build2 {
|
||||
emit(1)
|
||||
select2(this@build.get(), getInv()) // TODO
|
||||
select2(get(), Test.foo(this@build.getInv()))
|
||||
select2(get(), <!ARGUMENT_TYPE_MISMATCH!>Test.foo(this@build.getInv())<!>)
|
||||
select2(Test.foo(this@build.get()), Test.foo(getInv())) // TODO
|
||||
select2(Test.foo(get()), this@build.getInv())
|
||||
select2(Test.foo(get()), <!ARGUMENT_TYPE_MISMATCH!>this@build.getInv()<!>)
|
||||
select3(this@build.get(), getInv()) // TODO
|
||||
select3(get(), Test.foo(this@build.getInv()))
|
||||
select3(get(), <!ARGUMENT_TYPE_MISMATCH!>Test.foo(this@build.getInv())<!>)
|
||||
select3(Test.foo(this@build.get()), Test.foo(getInv())) // TODO
|
||||
select3(Test.foo(get()), this@build.getInv())
|
||||
select3(Test.foo(get()), <!ARGUMENT_TYPE_MISMATCH!>this@build.getInv()<!>)
|
||||
""
|
||||
}
|
||||
""
|
||||
|
||||
compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeInvariant.kt
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -OPT_IN_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-64802 (K2/PCLA difference)
|
||||
|
||||
// FILE: Test.java
|
||||
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// FIR_DUMP
|
||||
// !OPT_IN: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// ISSUE: KT-64823 (K2/PCLA difference)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class TypeDefinition<KotlinType : Any> {
|
||||
fun parse(parser: (serializedValue: String) -> KotlinType?): Unit = TODO()
|
||||
fun serialize(parser: (value: KotlinType) -> Any?): Unit = TODO()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <KotlinType : Any> defineType(definition: TypeDefinition<KotlinType>.() -> Unit): Unit = TODO()
|
||||
|
||||
fun main() {
|
||||
defineType {
|
||||
parse { it.toInt() }
|
||||
serialize { <!BUILDER_INFERENCE_STUB_RECEIVER!>it<!>.toString() }
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
FILE: kt36220.kt
|
||||
FILE: kt36220.fir.kt
|
||||
public final class TypeDefinition<KotlinType : R|kotlin/Any|> : R|kotlin/Any| {
|
||||
public constructor<KotlinType : R|kotlin/Any|>(): R|TypeDefinition<KotlinType>| {
|
||||
super<R|kotlin/Any|>()
|
||||
@@ -22,8 +22,8 @@ FILE: kt36220.kt
|
||||
^ R|<local>/it|.R|kotlin/text/toInt|()
|
||||
}
|
||||
)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Any?| <inline=NoInline> {
|
||||
^ (R|<local>/it| as R|kotlin/Any|).R|kotlin/Any.toString|()
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun <anonymous>(it: R|@R|kotlin/ParameterName|(name = String(value)) kotlin/Int|): R|kotlin/Any?| <inline=NoInline> {
|
||||
^ R|<local>/it|.R|kotlin/toString<Inapplicable(RESOLVED_WITH_ERROR): kotlin/toString>#|()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// FIR_IDENTICAL
|
||||
// FIR_DUMP
|
||||
// !OPT_IN: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// ISSUE: KT-64823 (K2/PCLA difference)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// FIR_DUMP
|
||||
// Similar to kt36220.kt, but with receivers instead of it
|
||||
// ISSUE: KT-64823 (K2/PCLA difference)
|
||||
|
||||
class TypeDefinition<KotlinType : Any> {
|
||||
fun parse(parser: (serializedValue: String) -> KotlinType?): Unit = TODO()
|
||||
fun serialize(parser: KotlinType.() -> Any?): Unit = TODO()
|
||||
}
|
||||
|
||||
fun <KotlinType : Any> defineType(definition: TypeDefinition<KotlinType>.() -> Unit): Unit = TODO()
|
||||
|
||||
fun foo() {
|
||||
defineType {
|
||||
parse { it.toInt() }
|
||||
serialize { toString() }
|
||||
}
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
defineType {
|
||||
parse { it.toInt() }
|
||||
serialize { <!CANNOT_INFER_PARAMETER_TYPE!>this<!>.toString() }
|
||||
}
|
||||
}
|
||||
Vendored
+5
-5
@@ -1,4 +1,4 @@
|
||||
FILE: stubCallOnReceiver.kt
|
||||
FILE: stubCallOnReceiver.fir.kt
|
||||
public final class TypeDefinition<KotlinType : R|kotlin/Any|> : R|kotlin/Any| {
|
||||
public constructor<KotlinType : R|kotlin/Any|>(): R|TypeDefinition<KotlinType>| {
|
||||
super<R|kotlin/Any|>()
|
||||
@@ -22,8 +22,8 @@ FILE: stubCallOnReceiver.kt
|
||||
^ R|<local>/it|.R|kotlin/text/toInt|()
|
||||
}
|
||||
)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun R|kotlin/Int|.<anonymous>(): R|kotlin/Any?| <inline=NoInline> {
|
||||
^ (this@R|special/anonymous| as R|kotlin/Any|).R|kotlin/Any.toString|()
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun <ERROR TYPE REF: Cannot infer type for receiver parameter>.<anonymous>(): R|kotlin/Any?| <inline=NoInline> {
|
||||
^ this@R|special/anonymous|.R|kotlin/toString|()
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -35,8 +35,8 @@ FILE: stubCallOnReceiver.kt
|
||||
^ R|<local>/it|.R|kotlin/text/toInt|()
|
||||
}
|
||||
)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun R|kotlin/Int|.<anonymous>(): R|kotlin/Any?| <inline=NoInline> {
|
||||
^ (this@R|special/anonymous| as R|kotlin/Any|).R|kotlin/Any.toString|()
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun <ERROR TYPE REF: Cannot infer type for receiver parameter>.<anonymous>(): R|kotlin/Any?| <inline=NoInline> {
|
||||
^ this@R|special/anonymous|.R|kotlin/toString|()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// FIR_IDENTICAL
|
||||
// FIR_DUMP
|
||||
// Similar to kt36220.kt, but with receivers instead of it
|
||||
// ISSUE: KT-64823 (K2/PCLA difference)
|
||||
|
||||
class TypeDefinition<KotlinType : Any> {
|
||||
fun parse(parser: (serializedValue: String) -> KotlinType?): Unit = TODO()
|
||||
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// FIR_DUMP
|
||||
// ISSUE: KT-64823 (K2/PCLA difference)
|
||||
|
||||
class TypeDefinition<KotlinType : Any> {
|
||||
fun parse(parser: (serializedValue: String) -> KotlinType?): Unit = TODO()
|
||||
fun serialize(parser: (value: KotlinType) -> Any?): Unit = TODO()
|
||||
}
|
||||
|
||||
fun <KotlinType : Any> defineType(definition: TypeDefinition<KotlinType>.() -> Unit): Unit = TODO()
|
||||
|
||||
fun main() {
|
||||
defineType {
|
||||
parse { it.toInt() }
|
||||
serialize {
|
||||
val i = it
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>i<!>.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+4
-4
@@ -1,4 +1,4 @@
|
||||
FILE: stubCallOnVariable.kt
|
||||
FILE: stubCallOnVariable.fir.kt
|
||||
public final class TypeDefinition<KotlinType : R|kotlin/Any|> : R|kotlin/Any| {
|
||||
public constructor<KotlinType : R|kotlin/Any|>(): R|TypeDefinition<KotlinType>| {
|
||||
super<R|kotlin/Any|>()
|
||||
@@ -22,9 +22,9 @@ FILE: stubCallOnVariable.kt
|
||||
^ R|<local>/it|.R|kotlin/text/toInt|()
|
||||
}
|
||||
)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun <anonymous>(it: <ERROR TYPE REF: Cannot infer type for parameter it>): R|kotlin/Any?| <inline=NoInline> {
|
||||
lval i: <ERROR TYPE REF: Cannot infer type for parameter it> = R|<local>/it|
|
||||
^ R|<local>/i|.R|kotlin/toString|()
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun <anonymous>(it: R|@R|kotlin/ParameterName|(name = String(value)) kotlin/Int|): R|kotlin/Any?| <inline=NoInline> {
|
||||
lval i: R|@R|kotlin/ParameterName|(name = String(value)) kotlin/Int| = R|<local>/it|
|
||||
^ R|<local>/i|.R|kotlin/toString<Inapplicable(RESOLVED_WITH_ERROR): kotlin/toString>#|()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// FIR_DUMP
|
||||
// ISSUE: KT-64823 (K2/PCLA difference)
|
||||
|
||||
class TypeDefinition<KotlinType : Any> {
|
||||
fun parse(parser: (serializedValue: String) -> KotlinType?): Unit = TODO()
|
||||
|
||||
Reference in New Issue
Block a user