[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:
Ivan Kochurkin
2023-10-10 20:05:39 +02:00
committed by Space Team
parent 2d61b9a477
commit 498f2e534a
25 changed files with 82 additions and 71 deletions
@@ -117,14 +117,7 @@ class FirSignatureEnhancement(
val newReturnTypeRef = enhanceReturnType(
firElement, emptyList(), firElement.computeDefaultQualifiers(),
predefinedEnhancementInfo = null
).let {
val lowerBound = it.type.lowerBoundIfFlexible()
if ((lowerBound.isString || lowerBound.isInt) && firElement.isStatic && firElement.initializer != null) {
it.withReplacedConeType(it.type.withNullability(ConeNullability.NOT_NULL, session.typeContext))
} else {
it
}
}
)
val symbol = FirFieldSymbol(original.callableId)
buildJavaField {