K1: report also TYPE_MISMATCH_WARNING in JvmSyntheticAssignmentChecker

#KT-56061 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-01-25 17:56:13 +01:00
committed by Space Team
parent f14effa8e8
commit cab0340497
4 changed files with 113 additions and 21 deletions
+43 -8
View File
@@ -31,6 +31,11 @@ fun foo(container: Container<*>, wrapper: Wrapper<String>) {
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>"123"<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>"123"<!>)
container.simple = null
container.setSimple(null)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>container.simple<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>container.getSimple()<!>)
container.simple = null!!
}
fun bar(container: Container<String>, wrapper: Wrapper<String>) {
@@ -47,32 +52,62 @@ fun baz(container: Container<Any>, wrapper: Wrapper<String>) {
container.setSimple("123")
}
fun gau(container: Container<String>, wrapper: Wrapper<Any>) {
fun gau(container: Container<String>, wrapper: Wrapper<Any>, arg: Any) {
container.wrapper = <!ASSIGNMENT_TYPE_MISMATCH!>wrapper<!>
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>456<!>
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>arg<!>
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>x<!>
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>O<!>
if (arg is String) {
container.simple = arg
}
}
fun dif(container: Container<String>, wrapper: Wrapper<Int>) {
container.wrapper = <!ASSIGNMENT_TYPE_MISMATCH!>wrapper<!>
}
object O
fun out(container: Container<out Any>, wrapper: Wrapper<String>) {
container.wrapper = <!ASSIGNMENT_TYPE_MISMATCH!>wrapper<!>
container.setWrapper(<!ARGUMENT_TYPE_MISMATCH!>wrapper<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>"123"<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>"123"<!>)
}
fun inn(container: Container<in String>, wrapper: Wrapper<Any>) {
container.wrapper = <!ASSIGNMENT_TYPE_MISMATCH!>wrapper<!>
container.setWrapper(<!ARGUMENT_TYPE_MISMATCH!>wrapper<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>x<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>O<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>O<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>456<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>456<!>)
}
val x = 456
fun inn(container: Container<in String>, wrapper: Wrapper<Any>, arg: Any) {
container.wrapper = <!ASSIGNMENT_TYPE_MISMATCH!>wrapper<!>
container.setWrapper(<!ARGUMENT_TYPE_MISMATCH!>wrapper<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>x<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>O<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>O<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>456<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>456<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>arg<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>arg<!>)
if (arg is String) {
container.simple = arg
container.setSimple(arg)
}
}
fun <T> generic(container: Container<out T>, wrapper: Wrapper<out T>, arg: T) {
container.wrapper = <!ASSIGNMENT_TYPE_MISMATCH!>wrapper<!>
container.setWrapper(<!ARGUMENT_TYPE_MISMATCH!>wrapper<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>x<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>O<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>O<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>456<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>456<!>)
container.simple = <!ASSIGNMENT_TYPE_MISMATCH!>arg<!>
container.setSimple(<!ARGUMENT_TYPE_MISMATCH!>arg<!>)
}