Fix diagnostic inferred type calculation for null in some cases
#KT-36222 fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun foo(f: () -> String) {}
|
||||
fun <K> select(x: K, y: K): K = x
|
||||
|
||||
fun test() {
|
||||
foo { select("non-null", null) } // inferred String? but String is expected
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun foo(f: () -> String) {}
|
||||
fun <K> select(x: K, y: K): K = x
|
||||
|
||||
fun test() {
|
||||
foo { <!TYPE_MISMATCH!>select("non-null", null)<!> } // inferred String? but String is expected
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ f: () -> kotlin.String): kotlin.Unit
|
||||
public fun </*0*/ K> select(/*0*/ x: K, /*1*/ y: K): K
|
||||
public fun test(): kotlin.Unit
|
||||
Reference in New Issue
Block a user