FIR: Load final static constant Java fields as non-nullable
This commit is contained in:
committed by
teamcityserver
parent
dba04bcf80
commit
46217318c0
+27
@@ -0,0 +1,27 @@
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
public final static String X = "";
|
||||
public final static String Y = "";
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun nullableStr(): String? = null
|
||||
|
||||
fun foo(w: Int): String {
|
||||
var x: String? = nullableStr()
|
||||
|
||||
if (x != null) {
|
||||
return x
|
||||
}
|
||||
|
||||
// Smartcast should work because when's entries' results are non-flexible
|
||||
x = nullableStr() ?: when (w) {
|
||||
1 -> JavaClass.X
|
||||
else -> JavaClass.Y
|
||||
}
|
||||
|
||||
return x
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
public final static String X = "";
|
||||
public final static String Y = "";
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun nullableStr(): String? = null
|
||||
|
||||
fun foo(w: Int): String {
|
||||
var x: String? = nullableStr()
|
||||
|
||||
if (x != null) {
|
||||
return <!DEBUG_INFO_SMARTCAST!>x<!>
|
||||
}
|
||||
|
||||
// Smartcast should work because when's entries' results are non-flexible
|
||||
x = nullableStr() ?: when (w) {
|
||||
1 -> JavaClass.X
|
||||
else -> JavaClass.Y
|
||||
}
|
||||
|
||||
return <!DEBUG_INFO_SMARTCAST!>x<!>
|
||||
}
|
||||
Reference in New Issue
Block a user