[K2] Avoid type check for Kotlin's property in ConstUtils

When we check Java field for constant initializer, we could
be asked to get and check the type of Kotlin's property that
is used in this Java field. But there is no guarantee that the type
resolve phase was finished and this type is available. So we just
check for `const` modifier and skip type check.

#KT-63752 Fixed
#KT-62558 Obsolete
#KT-61786 Declined
This commit is contained in:
Ivan Kylchik
2023-11-29 18:00:49 +01:00
committed by Space Team
parent 97ba3fe396
commit 79c300209e
21 changed files with 298 additions and 22 deletions
@@ -125,7 +125,7 @@ class FirSignatureEnhancement(
predefinedEnhancementInfo = null
).let {
val lowerBound = it.type.lowerBoundIfFlexible()
if ((lowerBound.isString || lowerBound.isInt) && firElement.isStatic && firElement.hasConstantInitializer) {
if (lowerBound.isString && firElement.isStatic && firElement.hasConstantInitializer) {
it.withReplacedConeType(it.type.withNullability(ConeNullability.NOT_NULL, session.typeContext))
} else {
it