[PSI2IR] Propagate smart cast information for variable loads.
This gives us more precise type information and can enable backend optimizations. This was motivated by when expressions not compiled to table switches in the JVM_IR backend. Fixed KT-36845.
This commit is contained in:
@@ -15,14 +15,14 @@ fun <T : CharSequence?> test2(x: T): Int {
|
||||
inline fun <reified T : CharSequence?> test3(x: Any): Int {
|
||||
return when {
|
||||
x !is T -> 0
|
||||
else -> x /*as CharSequence */.<get-length>()
|
||||
else -> x /*as T */.<get-length>()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : CharSequence> test4(x: Any?): Int {
|
||||
return when {
|
||||
x !is T -> 0
|
||||
else -> x /*as CharSequence */.<get-length>()
|
||||
else -> x /*as T */.<get-length>()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user