[FIR] Harden check of argument type properly

Before this commit, nullable argument could match not null parameter.
Now we require also correct nullability that breaks some cases
This commit is contained in:
simon.ogorodnik
2020-01-28 14:17:24 +03:00
committed by Mikhail Glukhikh
parent fe779bf7bd
commit 34e6649d31
82 changed files with 171 additions and 173 deletions
@@ -7,10 +7,10 @@ fun <E : CharSequence> foo1(x: E) {}
fun <E : CharSequence> E.foo2() {}
fun <F : String?> bar(x: F) {
A(x)
<!INAPPLICABLE_CANDIDATE!>A<!>(x)
<!INAPPLICABLE_CANDIDATE!>A<!><F>(x)
foo1(x)
<!INAPPLICABLE_CANDIDATE!>foo1<!>(x)
<!INAPPLICABLE_CANDIDATE!>foo1<!><F>(x)
x.<!INAPPLICABLE_CANDIDATE!>foo2<!>()
@@ -5,7 +5,7 @@ fun <E : String?, T : ((CharSequence) -> Unit)?> foo(x: E, y: T) {
}
if (y != null) {
y(x)
<!INAPPLICABLE_CANDIDATE!>y<!>(x)
}
if (x != null && y != null) {
@@ -6,7 +6,7 @@ fun <T> foo(): T {
val x1: T = null
val x2: T? = null
bar<T>(null)
<!INAPPLICABLE_CANDIDATE!>bar<!><T>(null)
bar<T?>(null)
return null
@@ -23,7 +23,7 @@ class A<F> {
val x1: F = null
val x2: F? = null
xyz(null)
<!INAPPLICABLE_CANDIDATE!>xyz<!>(null)
bar<F?>(null)
return null
@@ -18,14 +18,14 @@ class A<F> {
x2.checkType { _<F>() }
<!INAPPLICABLE_CANDIDATE!>foo1<!><F?>(y)
foo1(y)
<!INAPPLICABLE_CANDIDATE!>foo1<!>(y)
foo2<F?>(y)
val x3 = foo2(y)
x3.checkType { _<F?>() }
foo1<F>(y)
foo2<F>(y)
<!INAPPLICABLE_CANDIDATE!>foo1<!><F>(y)
<!INAPPLICABLE_CANDIDATE!>foo2<!><F>(y)
foo1<Z>(z)
@@ -38,7 +38,7 @@ class A<F> {
x4.checkType { _<Z>() }
<!INAPPLICABLE_CANDIDATE!>foo1<!><W>(w)
foo1(w)
<!INAPPLICABLE_CANDIDATE!>foo1<!>(w)
foo2<W>(w)
val x6 = foo2(w)
@@ -13,6 +13,6 @@ fun <T : String?> foo(x: T) {
bar1(x)
bar2(x)
bar3(x)
bar4(x)
<!INAPPLICABLE_CANDIDATE!>bar3<!>(x)
<!INAPPLICABLE_CANDIDATE!>bar4<!>(x)
}