[FIR] Implement ASSIGNMENT_TYPE_MISMATCH, RESULT_TYPE_MISMATCH diagnostics, fix tests

This commit is contained in:
Ivan Kochurkin
2021-04-19 12:12:49 +03:00
committed by TeamCityServer
parent aa70c952eb
commit e57108d4e8
40 changed files with 200 additions and 131 deletions
@@ -13,7 +13,7 @@ class Q {
private var y = foo<String>()
fun bar() {
x = y
x = <!ASSIGNMENT_TYPE_MISMATCH!>y<!>
x = foo<CharSequence>()
y = foo<String>()
@@ -29,7 +29,7 @@ fun <E> commonSupertype(x: E, y: E): E = x
fun foo() {
var myIt = A<String>().iterator()
myIt = A<Int>().iterator()
myIt = <!ASSIGNMENT_TYPE_MISMATCH!>A<Int>().iterator()<!>
val csIt: Iterator<CharSequence> = A<String>().iterator()
@@ -11,7 +11,7 @@ class Outer<T> {
z.checkType { _<Inner>() }
z.checkType { _<Outer<T>.Inner>() }
inner = x
inner = <!ASSIGNMENT_TYPE_MISMATCH!>x<!>
}
class Nested
@@ -12,7 +12,7 @@ fun <T : CharSequence?> foo(x: T) {
if (x != null) {}
y1 = x
y2 = x
y2 = <!ASSIGNMENT_TYPE_MISMATCH!>x<!>
bar1(x)
bar1<CharSequence>(x)
@@ -31,7 +31,7 @@ fun <T : CharSequence?> foo(x: T) {
if (x is CharSequence) {
y1 = x
y2 = x
y2 = <!ASSIGNMENT_TYPE_MISMATCH!>x<!>
bar1(x)
bar2(x)
@@ -24,10 +24,10 @@ class A<T : CharSequence?, E1 : T, E2: T?> {
}
if (1 == 1) {
t = tN
t = <!ASSIGNMENT_TYPE_MISMATCH!>tN<!>
}
t = y
t = <!ASSIGNMENT_TYPE_MISMATCH!>y<!>
if (y != null) {
t = y
@@ -5,6 +5,6 @@ interface Tr<T> {
}
fun test(t: Tr<*>) {
t.v = t
t.v = <!ASSIGNMENT_TYPE_MISMATCH!>t<!>
t.v checkType { _<Tr<*>>() }
}
}
@@ -8,7 +8,7 @@ interface Tr<T> {
fun test(t: Tr<*>) {
t.v = null!!
t.v = ""
t.v = <!ASSIGNMENT_TYPE_MISMATCH!>""<!>
t.v = <!NULL_FOR_NONNULL_TYPE!>null<!>
t.v checkType { _<Any?>() }
}
}
@@ -7,5 +7,5 @@ interface Tr<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)
t.v += null!!
}
<!ASSIGNMENT_TYPE_MISMATCH!>t.v += null!!<!>
}