K1: introduce synthetic assignment checker with deprecation for KT-54305
#KT-54305 Fixed Related to KT-54309
This commit is contained in:
committed by
Space Team
parent
7bd512fbb3
commit
80fa765333
+4
-4
@@ -20,7 +20,7 @@ public class Wrapper<W> {
|
||||
|
||||
fun foo(container: Container<*>, wrapper: Wrapper<String>) {
|
||||
container.w = <!TYPE_MISMATCH!>wrapper<!>
|
||||
container.wrapper = wrapper
|
||||
<!SYNTHETIC_SETTER_PROJECTED_OUT!>container.wrapper<!> = wrapper
|
||||
container.setWrapper(<!TYPE_MISMATCH!>wrapper<!>)
|
||||
}
|
||||
|
||||
@@ -42,16 +42,16 @@ fun dif(container: Container<String>, wrapper: Wrapper<Int>) {
|
||||
}
|
||||
|
||||
fun out(container: Container<out Any>, wrapper: Wrapper<String>) {
|
||||
container.wrapper = wrapper
|
||||
<!SYNTHETIC_SETTER_PROJECTED_OUT!>container.wrapper<!> = wrapper
|
||||
container.setWrapper(<!TYPE_MISMATCH!>wrapper<!>)
|
||||
}
|
||||
|
||||
fun inn(container: Container<in String>, wrapper: Wrapper<Any>) {
|
||||
container.wrapper = wrapper
|
||||
<!SYNTHETIC_SETTER_PROJECTED_OUT!>container.wrapper<!> = wrapper
|
||||
container.setWrapper(<!TYPE_MISMATCH!>wrapper<!>)
|
||||
}
|
||||
|
||||
fun <T> generic(container: Container<out T>, wrapper: Wrapper<out T>) {
|
||||
container.wrapper = wrapper
|
||||
<!SYNTHETIC_SETTER_PROJECTED_OUT!>container.wrapper<!> = wrapper
|
||||
container.setWrapper(<!TYPE_MISMATCH!>wrapper<!>)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: JavaClass.java
|
||||
import java.util.List;
|
||||
|
||||
public interface JavaClass<E> {
|
||||
List<? extends E> getFoo();
|
||||
void setFoo(List<? extends E> l);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo(x: JavaClass<in CharSequence>, l: MutableList<out CharSequence>) {
|
||||
x.setFoo(l) // OK
|
||||
x.foo = l // Should be OK, too
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ x: JavaClass<in kotlin.CharSequence>, /*1*/ l: kotlin.collections.MutableList<out kotlin.CharSequence>): kotlin.Unit
|
||||
|
||||
public interface JavaClass</*0*/ E : kotlin.Any!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun getFoo(): (kotlin.collections.MutableList<out E!>..kotlin.collections.List<E!>?)
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract fun setFoo(/*0*/ l: (kotlin.collections.MutableList<out E!>..kotlin.collections.List<E!>?)): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user