FIR: Fix test data after making LHS of assignment an expression

KT-54648
This commit is contained in:
Kirill Rakhman
2023-01-16 09:55:03 +01:00
committed by Space Team
parent ace47c06a5
commit 1eb18f13bd
68 changed files with 372 additions and 117 deletions
@@ -0,0 +1,30 @@
// !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_PARAMETER
// !CHECK_TYPE
// t is unused due to KT-4233
// FILE: test.kt
interface Tr<T> {
var v: T
}
fun test(t: Tr<*>) {
t.v = null!!
t.v = <!ASSIGNMENT_TYPE_MISMATCH!>""<!>
t.v = <!NULL_FOR_NONNULL_TYPE!>null<!>
t.v checkType { _<Any?>() }
}
fun test2(t: JavaClass<*>) {
t.v = null!!
t.v = <!ASSIGNMENT_TYPE_MISMATCH!>""<!>
t.v = null
t.v checkType { _<Any?>() }
}
// FILE: JavaClass.java
public interface JavaClass<T> {
public T getV();
public void setV(T v);
}
@@ -1,7 +1,9 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_PARAMETER
// !CHECK_TYPE
// t is unused due to KT-4233
// FILE: test.kt
interface Tr<T> {
var v: T
}
@@ -11,4 +13,18 @@ fun test(t: Tr<*>) {
<!SETTER_PROJECTED_OUT!>t.v<!> = ""
<!SETTER_PROJECTED_OUT!>t.v<!> = null
t.v checkType { _<Any?>() }
}
}
fun test2(t: JavaClass<*>) {
t.v = null!!
t.v = ""
t.v = null
t.v checkType { _<Any?>() }
}
// FILE: JavaClass.java
public interface JavaClass<T> {
public T getV();
public void setV(T v);
}
@@ -1,6 +1,15 @@
package
public fun test(/*0*/ t: Tr<*>): kotlin.Unit
public fun test2(/*0*/ t: JavaClass<*>): kotlin.Unit
public interface JavaClass</*0*/ T : kotlin.Any!> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract fun getV(): T!
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public abstract fun setV(/*0*/ v: T!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Tr</*0*/ T> {
public abstract var v: T
@@ -0,0 +1,10 @@
// !DIAGNOSTICS: -UNREACHABLE_CODE
interface Tr<T> {
var v: T
}
fun test(t: Tr<out String>) {
// resolved as t.v = t.v + null!!, where type of right operand is String,
// so TYPE_MISMATCH: String is not <: of Captured(out String)
<!ASSIGNMENT_TYPE_MISMATCH!>t.v += null!!<!>
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNREACHABLE_CODE
interface Tr<T> {
var v: T
@@ -8,4 +7,4 @@ fun test(t: Tr<out String>) {
// resolved as t.v = t.v + null!!, where type of right operand is String,
// so TYPE_MISMATCH: String is not <: of Captured(out String)
<!SETTER_PROJECTED_OUT!>t.v<!> += null!!
}
}