[k2, dfa] Smartcasts are not allowed on FirJavaField from other module
Handle case with FirField properly. Previously the code was returning STABLE_VALUE in that case. Note that in fact the changed 'when' branch expects only FirJavaField, as FirFieldImpl should be handled by FirBackingFieldSymbol-check at the beginning of the method. However, it is impossible to refer to FirJavaField directly due to module visibility Enumerate all cases more carefully via exhaustive 'when', it's more readable and will prevent potential issues in future in case more subclasses are added. ^KT-58279 Fixed
This commit is contained in:
committed by
Space Team
parent
6661a66fc3
commit
74fa6fc12c
+3
-3
@@ -11,8 +11,8 @@ public class J {
|
||||
// MODULE: app(lib)
|
||||
fun isCast() {
|
||||
if (J.staticFinalJava is String) {
|
||||
J.staticFinalJava.length
|
||||
(J.staticFinalJava <!USELESS_CAST!>as String<!>).length
|
||||
<!SMARTCAST_IMPOSSIBLE!>J.staticFinalJava<!>.length
|
||||
(J.staticFinalJava as String).length
|
||||
}
|
||||
|
||||
if (J.staticNonFinalJava is String) {
|
||||
@@ -23,7 +23,7 @@ fun isCast() {
|
||||
|
||||
fun asCast() {
|
||||
J.staticFinalJava as String
|
||||
J.staticFinalJava.length
|
||||
<!SMARTCAST_IMPOSSIBLE!>J.staticFinalJava<!>.length
|
||||
|
||||
J.staticNonFinalJava as String
|
||||
<!SMARTCAST_IMPOSSIBLE!>J.staticNonFinalJava<!>.length
|
||||
|
||||
Reference in New Issue
Block a user