[NI] Propagate non-null info on supertypes for capturing from bounds
#KT-31941 Fixed
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
open class Inv<T>(val value: String)
|
||||
|
||||
fun <T : Inv<*>?, F: Inv<out Any>?, G : Inv<*>> test1(t: T, f: F, g: G?) {
|
||||
if (t != null && f != null && g != null) {
|
||||
<!DEBUG_INFO_SMARTCAST!>t<!>.value
|
||||
<!DEBUG_INFO_SMARTCAST!>f<!>.value
|
||||
<!DEBUG_INFO_SMARTCAST!>g<!>.value
|
||||
}
|
||||
}
|
||||
|
||||
// Actually, this behavior is very questional as capturing shouldn't be performed deeper than for 1 level
|
||||
// But we preserve behavior of old inference here for now
|
||||
fun <T : K, K : Inv<*>?> test2(t: T) {
|
||||
if (t != null) {
|
||||
<!DEBUG_INFO_SMARTCAST!>t<!>.value
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : Inv<K>?, K : Inv<*>?> test3(t: T) {
|
||||
if (t != null) {
|
||||
<!DEBUG_INFO_SMARTCAST!>t<!>.value
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T : Inv<*>?, /*1*/ F : Inv<out kotlin.Any>?, /*2*/ G : Inv<*>> test1(/*0*/ t: T, /*1*/ f: F, /*2*/ g: G?): kotlin.Unit
|
||||
public fun </*0*/ T : K, /*1*/ K : Inv<*>?> test2(/*0*/ t: T): kotlin.Unit
|
||||
public fun </*0*/ T : Inv<K>?, /*1*/ K : Inv<*>?> test3(/*0*/ t: T): kotlin.Unit
|
||||
|
||||
public open class Inv</*0*/ T> {
|
||||
public constructor Inv</*0*/ T>(/*0*/ value: kotlin.String)
|
||||
public final val value: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user