K2: Adjust test data after PCLA implementation [red-to-red]

^KT-59791 In Progress
This commit is contained in:
Denis.Zharkov
2023-12-13 15:09:23 +01:00
committed by Space Team
parent 276f5b26d8
commit 6052e24626
63 changed files with 272 additions and 281 deletions
@@ -4,7 +4,7 @@
fun box(): String {
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildList<!> {
val foo = { first() }
val foo = { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>first<!>() }
add(0, foo)
}
return "OK"
@@ -4,7 +4,7 @@
fun box(): String {
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildList<!> {
val foo = { first() }
val foo = { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>first<!>() }
add(0, foo)
}
return "OK"
@@ -7,10 +7,10 @@ fun <T : Any> myBuilder(block: Foo<T>.() -> Unit) : Foo<T> = Foo<T>().apply(bloc
fun main(arg: Any) {
val x = 57
val value = <!TYPE_MISMATCH, TYPE_MISMATCH!>myBuilder {
val value = myBuilder {
doSmthng("one ")
run { a; this }.a = 10
<!BUILDER_INFERENCE_STUB_RECEIVER!>a += 1<!>
a <!NONE_APPLICABLE!>+=<!> 1
this.a = 57
this.<!ILLEGAL_SELECTOR, VARIABLE_EXPECTED!>(a)<!> = 57
a = x
@@ -19,6 +19,6 @@ fun main(arg: Any) {
if (arg is String) {
a = arg
}
}<!>
}
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(value.a?.<!UNRESOLVED_REFERENCE!>count<!> { <!UNRESOLVED_REFERENCE!>it<!> in 'l' .. 'q' })
}
@@ -62,8 +62,8 @@ fun main(arg: Any, condition: Boolean) {
// See KT-54664
val value3 = myBuilder {
accept("")
a = 45
bar(<!ARGUMENT_TYPE_MISMATCH, ARGUMENT_TYPE_MISMATCH!>::a<!>)
a = <!ASSIGNMENT_TYPE_MISMATCH!>45<!>
bar(::<!INAPPLICABLE_CANDIDATE!>a<!>)
}
fun baz(t: Int) {}
@@ -28,84 +28,84 @@ FILE: unsafeAssignmentExtra.fir.kt
}
public final fun main(arg: R|kotlin/Any|, condition: R|kotlin/Boolean|): R|kotlin/Unit| {
lval value: R|Foo<kotlin/Int>| = R|/myBuilder|<R|kotlin/Int|>(<L> = myBuilder@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<Stub (chain inference): TypeVariable(T)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<kotlin/Int>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
Unit
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(45)
{
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = R|<local>/<unary>|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>|
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = R|<local>/<unary>|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()
R|<local>/<unary>|
}
R|/bar|(::R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
R|/bar|(::R|SubstitutionOverride</Foo.a: R|TypeVariable(T)|>|)
when () {
(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| is R|kotlin/Int|) -> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(67)
(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| is R|kotlin/Int|) -> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(67)
{
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = R|<local>/<unary>|.<Ambiguity: dec, [kotlin/dec, kotlin/dec]>#()
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>|
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = R|<local>/<unary>|.<Ambiguity: dec, [kotlin/dec, kotlin/dec]>#()
R|<local>/<unary>|
}
R|/bar|(::R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
R|/bar|(::R|SubstitutionOverride</Foo.a: R|TypeVariable(T)|>|)
}
}
when (R|<local>/condition|) {
==($subj$, Boolean(true)) -> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(87)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(87)
}
==($subj$, Boolean(false)) -> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(65)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(65)
}
}
lval x: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/getValue, kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|
lval x: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/getValue, kotlin/getValue, kotlin/collections/getValue]>by this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>|
this@R|special/anonymous|.R|/change|<R|kotlin/Int|>(<L> = change@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(99)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(99)
}
)
}
)
lval value2: R|Foo<kotlin/String>| = R|/myBuilder|<R|kotlin/String|>(<L> = myBuilder@fun R|Foo<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(45)
when (R|<local>/condition|) {
==($subj$, Boolean(true)) -> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(87)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(87)
}
==($subj$, Boolean(false)) -> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(65)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(65)
}
}
this@R|special/anonymous|.R|/change|<R|kotlin/String|>(<L> = change@fun R|Foo<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(99)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(99)
}
)
when () {
(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| is R|kotlin/Int|) -> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(67)
(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| is R|kotlin/Int|) -> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(67)
}
}
}
)
lval value3: R|Foo<kotlin/Int>| = R|/myBuilder<CS errors: /myBuilder>#|<R|kotlin/Int|>(<L> = myBuilder@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
lval value3: R|Foo<kotlin/String>| = R|/myBuilder|<R|kotlin/String|>(<L> = myBuilder@fun R|Foo<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
R|/bar|(::R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(45)
R|/bar<Inapplicable(INAPPLICABLE): /bar>#|(::<Inapplicable(INAPPLICABLE): /Foo.a>#)
}
)
local final fun baz(t: R|kotlin/Int|): R|kotlin/Unit| {
}
lval value4: R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>| = R|/myBuilder<CS errors: /myBuilder>#|<R|it(kotlin/Comparable<*> & java/io/Serializable)|>(<L> = myBuilder@fun R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
lval value4: R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>| = R|/myBuilder|<R|it(kotlin/Comparable<*> & java/io/Serializable)|>(<L> = myBuilder@fun R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<Stub (chain inference): TypeVariable(T)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|it(kotlin/Comparable<*> & java/io/Serializable)|>| = Int(45)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<it(kotlin/Comparable<*> & java/io/Serializable)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
Unit
R|<local>/baz|(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
R|<local>/baz<Inapplicable(INAPPLICABLE): <local>/baz>#|(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|it(kotlin/Comparable<*> & java/io/Serializable)|>|)
}
)
}
@@ -1 +1,3 @@
/upperBoundViolation.fir.kt:(150,260): error: New inference error [NewConstraintError at Incorporate TypeVariable(E) <: kotlin/Number from Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call from position Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call: kotlin/String <!: kotlin/Number].
/upperBoundViolation.fir.kt:(227,245): error: Not enough information to infer type argument for 'T'.
/upperBoundViolation.fir.kt:(246,253): error: Argument type mismatch: actual type is 'kotlin.String', but 'kotlin.Number' was expected.
@@ -4,8 +4,8 @@
fun <T : Number> printGenericNumber(t: T) = println("Number is $t")
fun main() {
<!NEW_INFERENCE_ERROR!>buildList { // inferred into MutableList<String>
buildList { // inferred into MutableList<String>
add("Boom")
printGenericNumber(this[0])
}<!>
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>printGenericNumber<!>(<!ARGUMENT_TYPE_MISMATCH!>this[0]<!>)
}
}
@@ -5,7 +5,7 @@ FILE: upperBoundViolation.fir.kt
public final fun main(): R|kotlin/Unit| {
R|kotlin/collections/buildList<CS errors: kotlin/collections/buildList>#|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String(Boom))
R|/printGenericNumber|<R|kotlin/String|>(this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|Stub (chain inference): TypeVariable(E)|>|(Int(0)))
R|/printGenericNumber<Inapplicable(INAPPLICABLE): /printGenericNumber>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>(this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|kotlin/String|>|(Int(0)))
}
)
}