[K2] Revert changes done in KT-61786

Changes in this ticket remove type enhancement in java fields
for K2. But after KT-61920 fix, we can actually support it.
This commit is contained in:
Ivan Kylchik
2023-11-21 16:10:47 +01:00
committed by Space Team
parent 2680c8effd
commit 97ba3fe396
17 changed files with 88 additions and 35 deletions
@@ -123,7 +123,14 @@ 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.hasConstantInitializer) {
it.withReplacedConeType(it.type.withNullability(ConeNullability.NOT_NULL, session.typeContext))
} else {
it
}
}
val symbol = FirFieldSymbol(original.callableId)
buildJavaField {