[FIR] Don't enhance Int and String Java final static fields
It's effectively a breaking change (^KT-62558) K2 assigns flexible type to all static fields (from Java) and, for example, `String? becomes String unlike K1. It affects IR signature generating. That's why signature dump is disabled for some tests. ^KT-57811 Fixed ^KT-61786 Fixed
This commit is contained in:
committed by
Space Team
parent
2d61b9a477
commit
498f2e534a
compiler/fir/analysis-tests/testData/resolve/inference/noEnhancementOnFinalStaticConstFields.fir.txt
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
FILE: main.kt
|
||||
public final fun test(x1: R|kotlin/String?|): R|kotlin/String| {
|
||||
lval x: R|kotlin/String?|
|
||||
R|<local>/x| = R|<local>/x1| ?: Q|JavaClass|.R|/JavaClass.X*s|
|
||||
^test R|<local>/x|
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// ISSUE: KT-57811, KT-61786
|
||||
|
||||
// FILE: JavaClass.java
|
||||
|
||||
public class JavaClass {
|
||||
public static final String X = null;
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun test(x1: String?): String {
|
||||
val x: String?
|
||||
x = x1 ?: JavaClass.X
|
||||
return x
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: main.kt
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval project: R|kotlin/String| = Q|PlatformDataKeys|.R|/CommonDataKeys.PROJECT*s|
|
||||
lval project: R|kotlin/String!| = Q|PlatformDataKeys|.R|/CommonDataKeys.PROJECT*s|
|
||||
lval member: R|kotlin/String!| = R|/PlatformDataKeys.PlatformDataKeys|().R|/CommonDataKeys.MEMBER|
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user