NI: Add constraints which contain constraining type without projection
^KT-32243 Fixed ^KT-35172 Fixed
This commit is contained in:
committed by
victor.petukhov
parent
65cc0fa463
commit
775eb67219
+14
-3
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNCHECKED_CAST
|
||||
|
||||
interface ISample
|
||||
|
||||
@@ -9,15 +9,16 @@ fun <K> elvisSimple(x: K?, y: K): K = y
|
||||
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
|
||||
|
||||
fun <T : Number> materialize(): T? = null
|
||||
fun <T> Any?.materialize(): T = null as T
|
||||
|
||||
fun test(nullableSample: ISample, any: Any) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!><!TYPE_MISMATCH!>elvisSimple<!>(
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ISample?")!>elvisSimple(
|
||||
nullableSample,
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{ISample & Number}?")!>materialize()<!>
|
||||
)<!>
|
||||
|
||||
elvisSimple(
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!><!TYPE_MISMATCH!>elvisSimple<!>(nullableSample, materialize())<!>,
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ISample?")!>elvisSimple(nullableSample, materialize())<!>,
|
||||
any
|
||||
)
|
||||
|
||||
@@ -25,4 +26,14 @@ fun test(nullableSample: ISample, any: Any) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>elvisExact(nullableSample, materialize())<!>,
|
||||
any
|
||||
)
|
||||
|
||||
val a: String? = null
|
||||
|
||||
val x1: String? = run {
|
||||
a ?: <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>a?.materialize()<!>
|
||||
}
|
||||
|
||||
val x2 = run {
|
||||
a ?: <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>a?.materialize()<!>
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -4,6 +4,7 @@ package
|
||||
public fun </*0*/ K> elvisSimple(/*0*/ x: K?, /*1*/ y: K): K
|
||||
public fun </*0*/ T : kotlin.Number> materialize(): T?
|
||||
public fun test(/*0*/ nullableSample: ISample, /*1*/ any: kotlin.Any): kotlin.Unit
|
||||
public fun </*0*/ T> kotlin.Any?.materialize(): T
|
||||
|
||||
public interface ISample {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
|
||||
Reference in New Issue
Block a user