diff --git a/compiler/fir/evaluate/src/org/jetbrains/kotlin/fir/evaluate/FirCompileTimeConstantEvaluator.kt b/compiler/fir/evaluate/src/org/jetbrains/kotlin/fir/evaluate/FirCompileTimeConstantEvaluator.kt index 6ed4191cb5c..f6a7cd6a4bc 100644 --- a/compiler/fir/evaluate/src/org/jetbrains/kotlin/fir/evaluate/FirCompileTimeConstantEvaluator.kt +++ b/compiler/fir/evaluate/src/org/jetbrains/kotlin/fir/evaluate/FirCompileTimeConstantEvaluator.kt @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef import org.jetbrains.kotlin.fir.types.impl.FirImplicitIntTypeRef -import org.jetbrains.kotlin.resolve.constants.ConstantValue import org.jetbrains.kotlin.types.ConstantValueKind /** @@ -25,10 +24,10 @@ import org.jetbrains.kotlin.types.ConstantValueKind class FirCompileTimeConstantEvaluator { // TODO: Handle boolean operators, const property loading, class reference, array, annotation values, etc. - fun evaluate(expression: FirExpression): ConstantValue<*>? = + fun evaluate(expression: FirExpression): FirConstExpression<*>? = when (expression) { - is FirConstExpression<*> -> expression.value as? ConstantValue<*> - is FirFunctionCall -> evaluate(expression)?.value as? ConstantValue<*> + is FirConstExpression<*> -> expression + is FirFunctionCall -> evaluate(expression) else -> null } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt index 710302a180b..71712ff0358 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt @@ -38,6 +38,7 @@ abstract class KtAnalysisSession(final override val token: ValidityToken) : Vali KtSymbolContainingDeclarationProviderMixIn, KtSubtypingComponentMixIn, KtExpressionInfoProviderMixIn, + KtCompileTimeConstantProviderMixIn, KtSymbolsMixIn, KtReferenceResolveMixIn, KtReferenceShortenerMixIn, @@ -99,6 +100,9 @@ abstract class KtAnalysisSession(final override val token: ValidityToken) : Vali internal val expressionInfoProvider: KtExpressionInfoProvider get() = expressionInfoProviderImpl protected abstract val expressionInfoProviderImpl: KtExpressionInfoProvider + internal val compileTimeConstantProvider: KtCompileTimeConstantProvider get() = compileTimeConstantProviderImpl + protected abstract val compileTimeConstantProviderImpl: KtCompileTimeConstantProvider + internal val visibilityChecker: KtVisibilityChecker get() = visibilityCheckerImpl protected abstract val visibilityCheckerImpl: KtVisibilityChecker diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompileTimeConstantProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompileTimeConstantProvider.kt new file mode 100644 index 00000000000..773b649c6f0 --- /dev/null +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompileTimeConstantProvider.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.components + +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue +import org.jetbrains.kotlin.psi.KtExpression + +abstract class KtCompileTimeConstantProvider : KtAnalysisSessionComponent() { + abstract fun evaluate(expression: KtExpression): KtSimpleConstantValue<*>? +} + +interface KtCompileTimeConstantProviderMixIn : KtAnalysisSessionMixIn { + fun KtExpression.evaluate(): KtSimpleConstantValue<*>? = + analysisSession.compileTimeConstantProvider.evaluate(this) +} diff --git a/idea/idea-frontend-fir/build.gradle.kts b/idea/idea-frontend-fir/build.gradle.kts index cde3f77b190..1ee3242bddf 100644 --- a/idea/idea-frontend-fir/build.gradle.kts +++ b/idea/idea-frontend-fir/build.gradle.kts @@ -13,6 +13,7 @@ dependencies { compile(project(":compiler:fir:fir2ir")) compile(project(":compiler:ir.tree")) compile(project(":compiler:fir:resolve")) + compile(project(":compiler:fir:evaluate")) compile(project(":compiler:fir:checkers")) compile(project(":compiler:fir:checkers:checkers.jvm")) compile(project(":compiler:fir:java")) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt index a4724e822eb..35d45a5a3d9 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt @@ -14,10 +14,7 @@ import org.jetbrains.kotlin.fir.resolve.symbolProvider import org.jetbrains.kotlin.idea.fir.low.level.api.api.* import org.jetbrains.kotlin.idea.frontend.api.InvalidWayOfUsingAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.components.KtInheritorsProvider -import org.jetbrains.kotlin.idea.frontend.api.components.KtVisibilityChecker -import org.jetbrains.kotlin.idea.frontend.api.components.KtSymbolDeclarationRendererProvider -import org.jetbrains.kotlin.idea.frontend.api.components.KtTypeCreator +import org.jetbrains.kotlin.idea.frontend.api.components.* import org.jetbrains.kotlin.idea.frontend.api.fir.components.* import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirOverrideInfoProvider import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbolProvider @@ -70,6 +67,8 @@ private constructor( override val expressionInfoProviderImpl = KtFirExpressionInfoProvider(this, token) + override val compileTimeConstantProviderImpl: KtCompileTimeConstantProvider = KtFirCompileTimeConstantProvider(this, token) + override val overrideInfoProviderImpl = KtFirOverrideInfoProvider(this, token) override val visibilityCheckerImpl: KtVisibilityChecker = KtFirVisibilityChecker(this, token) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompileTimeConstantProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompileTimeConstantProvider.kt new file mode 100644 index 00000000000..9512265fbe1 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompileTimeConstantProvider.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.fir.components + +import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.evaluate.FirCompileTimeConstantEvaluator +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFir +import org.jetbrains.kotlin.idea.frontend.api.components.KtCompileTimeConstantProvider +import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.convertConstantExpression +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue +import org.jetbrains.kotlin.idea.frontend.api.tokens.ValidityToken +import org.jetbrains.kotlin.idea.frontend.api.withValidityAssertion +import org.jetbrains.kotlin.psi.KtExpression + +internal class KtFirCompileTimeConstantProvider( + override val analysisSession: KtFirAnalysisSession, + override val token: ValidityToken, +) : KtCompileTimeConstantProvider(), KtFirAnalysisSessionComponent { + + override fun evaluate(expression: KtExpression): KtSimpleConstantValue<*>? = withValidityAssertion { + when (val fir = expression.getOrBuildFir(firResolveState)) { + is FirExpression -> FirCompileTimeConstantEvaluator().evaluate(fir)?.convertConstantExpression() + else -> error("Unexpected ${fir::class}") + } + } +} diff --git a/plugins/uast-kotlin-fir/src/org/jetbrains/uast/kotlin/FirKotlinUastResolveProviderService.kt b/plugins/uast-kotlin-fir/src/org/jetbrains/uast/kotlin/FirKotlinUastResolveProviderService.kt index 869ba6c8aa0..06ea4d7bdb0 100644 --- a/plugins/uast-kotlin-fir/src/org/jetbrains/uast/kotlin/FirKotlinUastResolveProviderService.kt +++ b/plugins/uast-kotlin-fir/src/org/jetbrains/uast/kotlin/FirKotlinUastResolveProviderService.kt @@ -50,7 +50,9 @@ interface FirKotlinUastResolveProviderService : BaseKotlinUastResolveProviderSer } override fun evaluate(uExpression: UExpression): Any? { - // TODO("Not yet implemented") - return "not-yet-compile-time-constant" + val ktExpression = uExpression.sourcePsi as? KtExpression ?: return null + analyseForUast(ktExpression) { + return ktExpression.evaluate()?.value + } } } diff --git a/plugins/uast-kotlin-fir/testData/declaration/doWhile.log.fir.txt b/plugins/uast-kotlin-fir/testData/declaration/doWhile.log.fir.txt index 211db2ff0dd..d82a37d8d11 100644 --- a/plugins/uast-kotlin-fir/testData/declaration/doWhile.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/declaration/doWhile.log.fir.txt @@ -12,7 +12,7 @@ UFile (package = ) [!] UnknownKotlinExpression (PROPERTY) ULabeledExpression (label = Outer) UWhileExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = true) UBlockExpression [!] UnknownKotlinExpression (PREFIX_EXPRESSION) [!] UnknownKotlinExpression (PROPERTY) @@ -20,7 +20,7 @@ UFile (package = ) UDoWhileExpression UIfExpression [!] UnknownKotlinExpression (BINARY_EXPRESSION) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = false) UBreakExpression (label = null) UBlockExpression [!] UnknownKotlinExpression (PREFIX_EXPRESSION) diff --git a/plugins/uast-kotlin-fir/testData/declaration/doWhile.render.fir.txt b/plugins/uast-kotlin-fir/testData/declaration/doWhile.render.fir.txt index 9578a952cf0..564760e2da5 100644 --- a/plugins/uast-kotlin-fir/testData/declaration/doWhile.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/declaration/doWhile.render.fir.txt @@ -8,12 +8,12 @@ public final class DoWhileKt { } public static final fun kt44412() : void { [!] UnknownKotlinExpression (PROPERTY) - Outer@ while ("not-yet-compile-time-constant") { + Outer@ while (true) { [!] UnknownKotlinExpression (PREFIX_EXPRESSION) [!] UnknownKotlinExpression (PROPERTY) Inner@ do { [!] UnknownKotlinExpression (PREFIX_EXPRESSION) - }while (if ([!] UnknownKotlinExpression (BINARY_EXPRESSION)) "not-yet-compile-time-constant" else break) + }while (if ([!] UnknownKotlinExpression (BINARY_EXPRESSION)) false else break) if ([!] UnknownKotlinExpression (BINARY_EXPRESSION)) break } diff --git a/plugins/uast-kotlin-fir/testData/declaration/facade.log.fir.txt b/plugins/uast-kotlin-fir/testData/declaration/facade.log.fir.txt index 32c1f8663cf..863c3498732 100644 --- a/plugins/uast-kotlin-fir/testData/declaration/facade.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/declaration/facade.log.fir.txt @@ -3,7 +3,7 @@ UFile (package = declaration) UMethod (name = foo) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 42) UMethod (name = buzz) UParameter (name = $this$buzz) UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/declaration/facade.render.fir.txt b/plugins/uast-kotlin-fir/testData/declaration/facade.render.fir.txt index 2e71d6551c0..e6df32f86ec 100644 --- a/plugins/uast-kotlin-fir/testData/declaration/facade.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/declaration/facade.render.fir.txt @@ -2,7 +2,7 @@ package declaration public final class Utils { public static final fun foo() : int { - return "not-yet-compile-time-constant" + return 42 } public static final fun buzz($this$buzz: java.lang.String) : java.lang.String { return [!] UnknownKotlinExpression (THIS_EXPRESSION) + "... zzz..." diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/AnnotationParameters.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/AnnotationParameters.log.fir.txt index 2f71b52d015..dc98c9f9631 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/AnnotationParameters.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/AnnotationParameters.log.fir.txt @@ -3,7 +3,7 @@ UFile (package = ) UMethod (name = foo) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 5) UMethod (name = bar) UBlockExpression UReturnExpression @@ -11,11 +11,11 @@ UFile (package = ) UMethod (name = fooWithArrLiteral) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 5) UMethod (name = fooWithStrArrLiteral) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 3) UClass (name = IntRange) UAnnotationMethod (name = from) UAnnotationMethod (name = to) @@ -25,6 +25,6 @@ UFile (package = ) UAnnotationMethod (name = strs) UClass (name = WithDefaultValue) UAnnotationMethod (name = value) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 42) UClass (name = SuppressLint) UAnnotationMethod (name = value) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/AnnotationParameters.render.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/AnnotationParameters.render.fir.txt index e4699e82408..3825595809a 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/AnnotationParameters.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/AnnotationParameters.render.fir.txt @@ -1,15 +1,15 @@ public final class AnnotationParametersKt { public static final fun foo() : int { - return "not-yet-compile-time-constant" + return 5 } public static final fun bar() : void { return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) } public static final fun fooWithArrLiteral() : int { - return "not-yet-compile-time-constant" + return 5 } public static final fun fooWithStrArrLiteral() : int { - return "not-yet-compile-time-constant" + return 3 } } diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/CycleInTypeParameters.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/CycleInTypeParameters.log.fir.txt index 66a3f98d7dc..53b0d9bcb20 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/CycleInTypeParameters.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/CycleInTypeParameters.log.fir.txt @@ -2,7 +2,7 @@ UFile (package = ) UClass (name = CycleInTypeParametersKt) UField (name = a) UBinaryExpressionWithType - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = null) UTypeReferenceExpression (name = Device) UMethod (name = getA) UClass (name = Device) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/CycleInTypeParameters.render.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/CycleInTypeParameters.render.fir.txt index 6e1c64dfe02..39e27f8fbc4 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/CycleInTypeParameters.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/CycleInTypeParameters.render.fir.txt @@ -1,5 +1,5 @@ public final class CycleInTypeParametersKt { - private static final var a: Device = "not-yet-compile-time-constant" as? Device + private static final var a: Device = null as? Device public static final fun getA() : Device = UastEmptyExpression } diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/DefaultParameterValues.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/DefaultParameterValues.log.fir.txt index ce6c38f4c59..b9f6397b0c1 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/DefaultParameterValues.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/DefaultParameterValues.log.fir.txt @@ -2,7 +2,7 @@ UFile (package = ) UClass (name = DefaultParameterValuesKt) UMethod (name = foo) UParameter (name = a) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 1) UParameter (name = foo) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = null) UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/Elvis.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/Elvis.log.fir.txt index c6f976907da..492f48681ad 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/Elvis.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/Elvis.log.fir.txt @@ -4,11 +4,11 @@ UFile (package = ) UParameter (name = bar) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = null) UMethod (name = bar) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 42) UMethod (name = baz) UBlockExpression UReturnExpression diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/Elvis.render.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/Elvis.render.fir.txt index f1c6bd9e3e3..d0614bc009b 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/Elvis.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/Elvis.render.fir.txt @@ -1,9 +1,9 @@ public final class ElvisKt { public static final fun foo(bar: java.lang.String) : java.lang.String { - return "not-yet-compile-time-constant" + return null } public static final fun bar() : int { - return "not-yet-compile-time-constant" + return 42 } public static final fun baz() : java.lang.String { return [!] UnknownKotlinExpression (BINARY_EXPRESSION) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/ManyAlternatives.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/ManyAlternatives.log.fir.txt index a0d08134cef..039a3b490bb 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/ManyAlternatives.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/ManyAlternatives.log.fir.txt @@ -2,7 +2,7 @@ UFile (package = ) UClass (name = ClassA) UField (name = paramAndProp) UField (name = writebleProp) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UMethod (name = ClassA) UParameter (name = justParam) UParameter (name = paramAndProp) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/ManyAlternatives.render.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/ManyAlternatives.render.fir.txt index 0bca4f783e6..6b1860a85f2 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/ManyAlternatives.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/ManyAlternatives.render.fir.txt @@ -1,6 +1,6 @@ public final class ClassA { private final var paramAndProp: java.lang.String - private var writebleProp: int = "not-yet-compile-time-constant" + private var writebleProp: int = 0 public fun ClassA(justParam: int, paramAndProp: java.lang.String) = UastEmptyExpression public final fun getParamAndProp() : java.lang.String = UastEmptyExpression public final fun getWritebleProp() : int = UastEmptyExpression diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/NameContainingFile.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/NameContainingFile.log.fir.txt index a3ccf77498b..1204d47f950 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/NameContainingFile.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/NameContainingFile.log.fir.txt @@ -1,7 +1,7 @@ UFile (package = ) UClass (name = NameContainingFileKt) UField (name = xyzzy) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UMethod (name = bar) UBlockExpression UMethod (name = getXyzzy) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/NameContainingFile.render.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/NameContainingFile.render.fir.txt index 98703974596..45efa8e4033 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/NameContainingFile.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/NameContainingFile.render.fir.txt @@ -1,5 +1,5 @@ public final class NameContainingFileKt { - private static final var xyzzy: int = "not-yet-compile-time-constant" + private static final var xyzzy: int = 0 public static final fun bar() : void { } public static final fun getXyzzy() : int = UastEmptyExpression diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/ParametersDisorder.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/ParametersDisorder.log.fir.txt index d636fdbffd2..b21cb2b8ec3 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/ParametersDisorder.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/ParametersDisorder.log.fir.txt @@ -6,7 +6,7 @@ UFile (package = ) UBlockExpression UMethod (name = withDefault) UParameter (name = c) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 1) UParameter (name = d) ULiteralExpression (value = "aaa") UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/ParametersWithDefaultValues.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/ParametersWithDefaultValues.log.fir.txt index 98278fc4d24..a8194362b83 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/ParametersWithDefaultValues.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/ParametersWithDefaultValues.log.fir.txt @@ -4,7 +4,7 @@ UFile (package = ) UParameter (name = a) UParameter (name = b) UParameter (name = c) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UParameter (name = flag) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = false) UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyReferences.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyReferences.log.fir.txt index 2daf75a4857..3b20d1a26c9 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyReferences.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyReferences.log.fir.txt @@ -18,7 +18,7 @@ UFile (package = ) [!] UnknownKotlinExpression (POSTFIX_EXPRESSION) UClass (name = A) UField (name = privateProp) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UField (name = mutableProp) UMethod (name = A) UParameter (name = init) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyReferences.render.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyReferences.render.fir.txt index dd060d33d50..7644e61a6ec 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyReferences.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyReferences.render.fir.txt @@ -17,7 +17,7 @@ public final class PropertyReferencesKt { } public final class A { - private var privateProp: int = "not-yet-compile-time-constant" + private var privateProp: int = 0 private var mutableProp: int public fun A(init: int) { { diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyWithAnnotation.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyWithAnnotation.log.fir.txt index fcb7c3ccec1..e7abf376d59 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyWithAnnotation.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyWithAnnotation.log.fir.txt @@ -1,16 +1,16 @@ UFile (package = ) UClass (name = PropertyWithAnnotationKt) UField (name = prop1) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UMethod (name = getProp1) UMethod (name = getProp2) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UMethod (name = getProp3) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UMethod (name = setProp3) UParameter (name = value) UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyWithAnnotation.render.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyWithAnnotation.render.fir.txt index a8b3ed50e42..e4544f40ab6 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyWithAnnotation.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/PropertyWithAnnotation.render.fir.txt @@ -1,11 +1,11 @@ public final class PropertyWithAnnotationKt { - private static final var prop1: int = "not-yet-compile-time-constant" + private static final var prop1: int = 0 public static final fun getProp1() : int = UastEmptyExpression public static final fun getProp2() : int { - return "not-yet-compile-time-constant" + return 0 } public static final fun getProp3() : int { - return "not-yet-compile-time-constant" + return 0 } public static final fun setProp3(value: int) : void { [!] UnknownKotlinExpression (BINARY_EXPRESSION) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/StringTemplateComplex.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/StringTemplateComplex.log.fir.txt index 4061e629cf4..7794c276c41 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/StringTemplateComplex.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/StringTemplateComplex.log.fir.txt @@ -36,7 +36,7 @@ UFile (package = ) UMethod (name = getEmpty) UMethod (name = simpleForTemplate) UParameter (name = i) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UBlockExpression UReturnExpression [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/StringTemplateComplexForUInjectionHost.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/StringTemplateComplexForUInjectionHost.log.fir.txt index 0f7cccd2981..b054b6535c7 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/StringTemplateComplexForUInjectionHost.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/StringTemplateComplexForUInjectionHost.log.fir.txt @@ -36,7 +36,7 @@ UFile (package = ) UMethod (name = getEmpty) UMethod (name = simpleForTemplate) UParameter (name = i) - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = 0) UBlockExpression UReturnExpression [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/TypeAliasExpansionWithOtherAliasInArgument.log.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/TypeAliasExpansionWithOtherAliasInArgument.log.fir.txt index d0023ca8562..cc971cdc8ee 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/TypeAliasExpansionWithOtherAliasInArgument.log.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/TypeAliasExpansionWithOtherAliasInArgument.log.fir.txt @@ -5,10 +5,10 @@ UFile (package = ) UParameter (name = x) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = null) UMethod (name = bar) UParameter (name = $this$bar) UParameter (name = x) UBlockExpression UReturnExpression - ULiteralExpression (value = "not-yet-compile-time-constant") + ULiteralExpression (value = null) diff --git a/plugins/uast-kotlin-fir/testData/legacyRenderLog/TypeAliasExpansionWithOtherAliasInArgument.render.fir.txt b/plugins/uast-kotlin-fir/testData/legacyRenderLog/TypeAliasExpansionWithOtherAliasInArgument.render.fir.txt index 5bc8b8986d8..0d4b98a764e 100644 --- a/plugins/uast-kotlin-fir/testData/legacyRenderLog/TypeAliasExpansionWithOtherAliasInArgument.render.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyRenderLog/TypeAliasExpansionWithOtherAliasInArgument.render.fir.txt @@ -1,8 +1,8 @@ public final class TypeAliasExpansionWithOtherAliasInArgumentKt { public static final fun foo($this$foo: kotlin.jvm.functions.Function1, x: kotlin.jvm.functions.Function1) : kotlin.jvm.functions.Function1 { - return "not-yet-compile-time-constant" + return null } public static final fun bar($this$bar: java.util.Map, x: java.util.Map) : java.util.Map { - return "not-yet-compile-time-constant" + return null } } diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/AnnotationParameters.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/AnnotationParameters.types.fir.txt index d6000967617..4a9598c2a90 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/AnnotationParameters.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/AnnotationParameters.types.fir.txt @@ -2,20 +2,20 @@ UFile (package = ) [public final class AnnotationParametersKt {...] UClass (name = AnnotationParametersKt) [public final class AnnotationParametersKt {...}] UMethod (name = foo) [public static final fun foo() : int {...}] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UReturnExpression [return 5] + ULiteralExpression (value = 5) [5] : PsiType:int UMethod (name = bar) [public static final fun bar() : void {...}] UBlockExpression [{...}] UReturnExpression [return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] UMethod (name = fooWithArrLiteral) [public static final fun fooWithArrLiteral() : int {...}] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UReturnExpression [return 5] + ULiteralExpression (value = 5) [5] : PsiType:int UMethod (name = fooWithStrArrLiteral) [public static final fun fooWithStrArrLiteral() : int {...}] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UReturnExpression [return 3] + ULiteralExpression (value = 3) [3] : PsiType:int UClass (name = IntRange) [public abstract annotation IntRange {...}] UAnnotationMethod (name = from) [public abstract fun from() : long = UastEmptyExpression] UAnnotationMethod (name = to) [public abstract fun to() : long = UastEmptyExpression] @@ -25,6 +25,6 @@ UFile (package = ) [public final class AnnotationParametersKt {...] UAnnotationMethod (name = strs) [public abstract fun strs() : java.lang.String[] = UastEmptyExpression] UClass (name = WithDefaultValue) [public abstract annotation WithDefaultValue {...}] UAnnotationMethod (name = value) [public abstract fun value() : int = UastEmptyExpression] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + ULiteralExpression (value = 42) [42] : PsiType:int UClass (name = SuppressLint) [public abstract annotation SuppressLint {...}] UAnnotationMethod (name = value) [public abstract fun value() : java.lang.String[] = UastEmptyExpression] diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/CycleInTypeParameters.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/CycleInTypeParameters.types.fir.txt index e55dbd2c121..93e03dcd0d5 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/CycleInTypeParameters.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/CycleInTypeParameters.types.fir.txt @@ -1,8 +1,8 @@ UFile (package = ) [public final class CycleInTypeParametersKt {...] UClass (name = CycleInTypeParametersKt) [public final class CycleInTypeParametersKt {...}] - UField (name = a) [private static final var a: Device = "not-yet-compile-time-constant" as? Device] - UBinaryExpressionWithType ["not-yet-compile-time-constant" as? Device] : PsiType:Device - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:Void + UField (name = a) [private static final var a: Device = null as? Device] + UBinaryExpressionWithType [null as? Device] : PsiType:Device + ULiteralExpression (value = null) [null] : PsiType:Void UTypeReferenceExpression (name = Device) [Device] UMethod (name = getA) [public static final fun getA() : Device = UastEmptyExpression] UClass (name = Device) [public final class Device {...}] diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/DefaultParameterValues.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/DefaultParameterValues.types.fir.txt index f5c0571d321..71d9a13c312 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/DefaultParameterValues.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/DefaultParameterValues.types.fir.txt @@ -1,8 +1,8 @@ UFile (package = ) [public final class DefaultParameterValuesKt {...] UClass (name = DefaultParameterValuesKt) [public final class DefaultParameterValuesKt {...}] UMethod (name = foo) [public static final fun foo(a: int, foo: java.lang.String) : void {...}] - UParameter (name = a) [var a: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int - UParameter (name = foo) [var foo: java.lang.String = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:Void + UParameter (name = a) [var a: int = 1] + ULiteralExpression (value = 1) [1] : PsiType:int + UParameter (name = foo) [var foo: java.lang.String = null] + ULiteralExpression (value = null) [null] : PsiType:Void UBlockExpression [{...}] : PsiType:Unit diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/Elvis.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/Elvis.types.fir.txt index 373ede52234..22388dbd2e5 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/Elvis.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/Elvis.types.fir.txt @@ -3,12 +3,12 @@ UFile (package = ) [public final class ElvisKt {...] UMethod (name = foo) [public static final fun foo(bar: java.lang.String) : java.lang.String {...}] UParameter (name = bar) [var bar: java.lang.String] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:Void + UReturnExpression [return null] + ULiteralExpression (value = null) [null] : PsiType:Void UMethod (name = bar) [public static final fun bar() : int {...}] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UReturnExpression [return 42] + ULiteralExpression (value = 42) [42] : PsiType:int UMethod (name = baz) [public static final fun baz() : java.lang.String {...}] UBlockExpression [{...}] : PsiType:Void UReturnExpression [return [!] UnknownKotlinExpression (BINARY_EXPRESSION)] : PsiType:Void diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/ManyAlternatives.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/ManyAlternatives.types.fir.txt index 7f41a706ea9..75711aced2f 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/ManyAlternatives.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/ManyAlternatives.types.fir.txt @@ -1,8 +1,8 @@ UFile (package = ) [public final class ClassA {...] UClass (name = ClassA) [public final class ClassA {...}] UField (name = paramAndProp) [private final var paramAndProp: java.lang.String] - UField (name = writebleProp) [private var writebleProp: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UField (name = writebleProp) [private var writebleProp: int = 0] + ULiteralExpression (value = 0) [0] : PsiType:int UMethod (name = ClassA) [public fun ClassA(justParam: int, paramAndProp: java.lang.String) = UastEmptyExpression] UParameter (name = justParam) [var justParam: int] UParameter (name = paramAndProp) [var paramAndProp: java.lang.String] diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/NameContainingFile.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/NameContainingFile.types.fir.txt index 9f985981b1f..b4b5733e756 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/NameContainingFile.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/NameContainingFile.types.fir.txt @@ -1,7 +1,7 @@ UFile (package = ) [public final class NameContainingFileKt {...] UClass (name = NameContainingFileKt) [public final class NameContainingFileKt {...}] - UField (name = xyzzy) [private static final var xyzzy: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UField (name = xyzzy) [private static final var xyzzy: int = 0] + ULiteralExpression (value = 0) [0] : PsiType:int UMethod (name = bar) [public static final fun bar() : void {...}] UBlockExpression [{...}] : PsiType:Unit UMethod (name = getXyzzy) [public static final fun getXyzzy() : int = UastEmptyExpression] diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/ParametersDisorder.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/ParametersDisorder.types.fir.txt index 334dd048ae4..6fe9fe140ef 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/ParametersDisorder.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/ParametersDisorder.types.fir.txt @@ -5,8 +5,8 @@ UFile (package = ) [public final class ParametersDisorderKt {...] UParameter (name = b) [var b: float] UBlockExpression [{...}] : PsiType:Unit UMethod (name = withDefault) [public static final fun withDefault(c: int, d: java.lang.String) : void {...}] - UParameter (name = c) [var c: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UParameter (name = c) [var c: int = 1] + ULiteralExpression (value = 1) [1] : PsiType:int UParameter (name = d) [var d: java.lang.String = "aaa"] ULiteralExpression (value = "aaa") ["aaa"] : PsiType:String UBlockExpression [{...}] : PsiType:Unit diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/ParametersWithDefaultValues.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/ParametersWithDefaultValues.types.fir.txt index d7009b9bd5b..f03a5d35c5c 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/ParametersWithDefaultValues.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/ParametersWithDefaultValues.types.fir.txt @@ -3,8 +3,8 @@ UFile (package = ) [public final class ParametersWithDefaultValuesKt {...] UMethod (name = foo) [public static final fun foo(a: int, b: java.lang.String, c: int, flag: boolean) : void {...}] UParameter (name = a) [var a: int] UParameter (name = b) [var b: java.lang.String] - UParameter (name = c) [var c: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int - UParameter (name = flag) [var flag: boolean = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:boolean + UParameter (name = c) [var c: int = 0] + ULiteralExpression (value = 0) [0] : PsiType:int + UParameter (name = flag) [var flag: boolean = false] + ULiteralExpression (value = false) [false] : PsiType:boolean UBlockExpression [{...}] : PsiType:Unit diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/PropertyReferences.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/PropertyReferences.types.fir.txt index 49f3f7dc909..4b5f4cdae52 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/PropertyReferences.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/PropertyReferences.types.fir.txt @@ -17,8 +17,8 @@ UFile (package = ) [public final class PropertyReferencesKt {...] [!] UnknownKotlinExpression (PREFIX_EXPRESSION) [[!] UnknownKotlinExpression (PREFIX_EXPRESSION)] [!] UnknownKotlinExpression (POSTFIX_EXPRESSION) [[!] UnknownKotlinExpression (POSTFIX_EXPRESSION)] UClass (name = A) [public final class A {...}] - UField (name = privateProp) [private var privateProp: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UField (name = privateProp) [private var privateProp: int = 0] + ULiteralExpression (value = 0) [0] : PsiType:int UField (name = mutableProp) [private var mutableProp: int] UMethod (name = A) [public fun A(init: int) {...}] UParameter (name = init) [var init: int] diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/PropertyWithAnnotation.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/PropertyWithAnnotation.types.fir.txt index e53318d4b26..775993e7d11 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/PropertyWithAnnotation.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/PropertyWithAnnotation.types.fir.txt @@ -1,16 +1,16 @@ UFile (package = ) [public final class PropertyWithAnnotationKt {...] UClass (name = PropertyWithAnnotationKt) [public final class PropertyWithAnnotationKt {...}] - UField (name = prop1) [private static final var prop1: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UField (name = prop1) [private static final var prop1: int = 0] + ULiteralExpression (value = 0) [0] : PsiType:int UMethod (name = getProp1) [public static final fun getProp1() : int = UastEmptyExpression] UMethod (name = getProp2) [public static final fun getProp2() : int {...}] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UReturnExpression [return 0] + ULiteralExpression (value = 0) [0] : PsiType:int UMethod (name = getProp3) [public static final fun getProp3() : int {...}] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UReturnExpression [return 0] + ULiteralExpression (value = 0) [0] : PsiType:int UMethod (name = setProp3) [public static final fun setProp3(value: int) : void {...}] UParameter (name = value) [var value: int] UBlockExpression [{...}] : PsiType:Unit diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/StringTemplateComplex.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/StringTemplateComplex.types.fir.txt index 298d013bd57..a081bbb0451 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/StringTemplateComplex.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/StringTemplateComplex.types.fir.txt @@ -35,8 +35,8 @@ UFile (package = ) [public final class StringTemplateComplexKt {...] UMethod (name = getLiteralInLiteral2) [public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression] UMethod (name = getEmpty) [public static final fun getEmpty() : java.lang.String = UastEmptyExpression] UMethod (name = simpleForTemplate) [public static final fun simpleForTemplate(i: int) : java.lang.String {...}] - UParameter (name = i) [var i: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UParameter (name = i) [var i: int = 0] + ULiteralExpression (value = 0) [0] : PsiType:int UBlockExpression [{...}] UReturnExpression [return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/StringTemplateComplexForUInjectionHost.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/StringTemplateComplexForUInjectionHost.types.fir.txt index 1ab45cce83e..3ba5cb0635b 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/StringTemplateComplexForUInjectionHost.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/StringTemplateComplexForUInjectionHost.types.fir.txt @@ -35,8 +35,8 @@ UFile (package = ) [public final class StringTemplateComplexForUInjectionHostKt UMethod (name = getLiteralInLiteral2) [public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression] UMethod (name = getEmpty) [public static final fun getEmpty() : java.lang.String = UastEmptyExpression] UMethod (name = simpleForTemplate) [public static final fun simpleForTemplate(i: int) : java.lang.String {...}] - UParameter (name = i) [var i: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + UParameter (name = i) [var i: int = 0] + ULiteralExpression (value = 0) [0] : PsiType:int UBlockExpression [{...}] UReturnExpression [return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] diff --git a/plugins/uast-kotlin-fir/testData/legacyTypes/TypeAliasExpansionWithOtherAliasInArgument.types.fir.txt b/plugins/uast-kotlin-fir/testData/legacyTypes/TypeAliasExpansionWithOtherAliasInArgument.types.fir.txt index 5e9e14ba2cb..e0a85413234 100644 --- a/plugins/uast-kotlin-fir/testData/legacyTypes/TypeAliasExpansionWithOtherAliasInArgument.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyTypes/TypeAliasExpansionWithOtherAliasInArgument.types.fir.txt @@ -4,11 +4,11 @@ UFile (package = ) [public final class TypeAliasExpansionWithOtherAliasInArgumen UParameter (name = $this$foo) [var $this$foo: kotlin.jvm.functions.Function1] UParameter (name = x) [var x: kotlin.jvm.functions.Function1] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:Void + UReturnExpression [return null] + ULiteralExpression (value = null) [null] : PsiType:Void UMethod (name = bar) [public static final fun bar($this$bar: java.util.Map, x: java.util.Map) : java.util.Map {...}] UParameter (name = $this$bar) [var $this$bar: java.util.Map] UParameter (name = x) [var x: java.util.Map] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:Void + UReturnExpression [return null] + ULiteralExpression (value = null) [null] : PsiType:Void diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/AnnotationParameters.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/AnnotationParameters.values.fir.txt index c2db46a3513..94c5dcab046 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/AnnotationParameters.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/AnnotationParameters.values.fir.txt @@ -2,20 +2,20 @@ UFile (package = ) [public final class AnnotationParametersKt {...] UClass (name = AnnotationParametersKt) [public final class AnnotationParametersKt {...}] UMethod (name = foo) [public static final fun foo() : int {...}] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return 5] = Nothing + ULiteralExpression (value = 5) [5] = (long)5 UMethod (name = bar) [public static final fun bar() : void {...}] UBlockExpression [{...}] = Nothing UReturnExpression [return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] = Nothing [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] = Undetermined UMethod (name = fooWithArrLiteral) [public static final fun fooWithArrLiteral() : int {...}] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return 5] = Nothing + ULiteralExpression (value = 5) [5] = (long)5 UMethod (name = fooWithStrArrLiteral) [public static final fun fooWithStrArrLiteral() : int {...}] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return 3] = Nothing + ULiteralExpression (value = 3) [3] = (long)3 UClass (name = IntRange) [public abstract annotation IntRange {...}] UAnnotationMethod (name = from) [public abstract fun from() : long = UastEmptyExpression] UAnnotationMethod (name = to) [public abstract fun to() : long = UastEmptyExpression] @@ -25,6 +25,6 @@ UFile (package = ) [public final class AnnotationParametersKt {...] UAnnotationMethod (name = strs) [public abstract fun strs() : java.lang.String[] = UastEmptyExpression] UClass (name = WithDefaultValue) [public abstract annotation WithDefaultValue {...}] UAnnotationMethod (name = value) [public abstract fun value() : int = UastEmptyExpression] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + ULiteralExpression (value = 42) [42] = (long)42 UClass (name = SuppressLint) [public abstract annotation SuppressLint {...}] UAnnotationMethod (name = value) [public abstract fun value() : java.lang.String[] = UastEmptyExpression] diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/CycleInTypeParameters.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/CycleInTypeParameters.values.fir.txt index aa4c9858edf..9b6b1671712 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/CycleInTypeParameters.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/CycleInTypeParameters.values.fir.txt @@ -1,8 +1,8 @@ UFile (package = ) [public final class CycleInTypeParametersKt {...] UClass (name = CycleInTypeParametersKt) [public final class CycleInTypeParametersKt {...}] - UField (name = a) [private static final var a: Device = "not-yet-compile-time-constant" as? Device] - UBinaryExpressionWithType ["not-yet-compile-time-constant" as? Device] = Undetermined - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UField (name = a) [private static final var a: Device = null as? Device] + UBinaryExpressionWithType [null as? Device] = Undetermined + ULiteralExpression (value = null) [null] = null UTypeReferenceExpression (name = Device) [Device] = Undetermined UMethod (name = getA) [public static final fun getA() : Device = UastEmptyExpression] UClass (name = Device) [public final class Device {...}] diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/DefaultParameterValues.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/DefaultParameterValues.values.fir.txt index 669578a532e..adcaf71e5ee 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/DefaultParameterValues.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/DefaultParameterValues.values.fir.txt @@ -1,8 +1,8 @@ UFile (package = ) [public final class DefaultParameterValuesKt {...] UClass (name = DefaultParameterValuesKt) [public final class DefaultParameterValuesKt {...}] UMethod (name = foo) [public static final fun foo(a: int, foo: java.lang.String) : void {...}] - UParameter (name = a) [var a: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" - UParameter (name = foo) [var foo: java.lang.String = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UParameter (name = a) [var a: int = 1] + ULiteralExpression (value = 1) [1] = (long)1 + UParameter (name = foo) [var foo: java.lang.String = null] + ULiteralExpression (value = null) [null] = null UBlockExpression [{...}] = Undetermined diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/Elvis.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/Elvis.values.fir.txt index 83d8b635384..abffcc59f24 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/Elvis.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/Elvis.values.fir.txt @@ -3,12 +3,12 @@ UFile (package = ) [public final class ElvisKt {...] UMethod (name = foo) [public static final fun foo(bar: java.lang.String) : java.lang.String {...}] UParameter (name = bar) [var bar: java.lang.String] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return null] = Nothing + ULiteralExpression (value = null) [null] = null UMethod (name = bar) [public static final fun bar() : int {...}] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return 42] = Nothing + ULiteralExpression (value = 42) [42] = (long)42 UMethod (name = baz) [public static final fun baz() : java.lang.String {...}] UBlockExpression [{...}] = Nothing UReturnExpression [return [!] UnknownKotlinExpression (BINARY_EXPRESSION)] = Nothing diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/ManyAlternatives.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/ManyAlternatives.values.fir.txt index 04a113297b6..e244ea51e8a 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/ManyAlternatives.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/ManyAlternatives.values.fir.txt @@ -1,8 +1,8 @@ UFile (package = ) [public final class ClassA {...] UClass (name = ClassA) [public final class ClassA {...}] UField (name = paramAndProp) [private final var paramAndProp: java.lang.String] - UField (name = writebleProp) [private var writebleProp: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UField (name = writebleProp) [private var writebleProp: int = 0] + ULiteralExpression (value = 0) [0] = (long)0 UMethod (name = ClassA) [public fun ClassA(justParam: int, paramAndProp: java.lang.String) = UastEmptyExpression] UParameter (name = justParam) [var justParam: int] UParameter (name = paramAndProp) [var paramAndProp: java.lang.String] diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/NameContainingFile.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/NameContainingFile.values.fir.txt index dd30e8648b9..eb619efb26d 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/NameContainingFile.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/NameContainingFile.values.fir.txt @@ -1,7 +1,7 @@ UFile (package = ) [public final class NameContainingFileKt {...] UClass (name = NameContainingFileKt) [public final class NameContainingFileKt {...}] - UField (name = xyzzy) [private static final var xyzzy: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UField (name = xyzzy) [private static final var xyzzy: int = 0] + ULiteralExpression (value = 0) [0] = (long)0 UMethod (name = bar) [public static final fun bar() : void {...}] UBlockExpression [{...}] = Undetermined UMethod (name = getXyzzy) [public static final fun getXyzzy() : int = UastEmptyExpression] diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/ParametersDisorder.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/ParametersDisorder.values.fir.txt index 6534b1aeb57..f1ee1465983 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/ParametersDisorder.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/ParametersDisorder.values.fir.txt @@ -5,8 +5,8 @@ UFile (package = ) [public final class ParametersDisorderKt {...] UParameter (name = b) [var b: float] UBlockExpression [{...}] = Undetermined UMethod (name = withDefault) [public static final fun withDefault(c: int, d: java.lang.String) : void {...}] - UParameter (name = c) [var c: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UParameter (name = c) [var c: int = 1] + ULiteralExpression (value = 1) [1] = (long)1 UParameter (name = d) [var d: java.lang.String = "aaa"] ULiteralExpression (value = "aaa") ["aaa"] = "aaa" UBlockExpression [{...}] = Undetermined diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/ParametersWithDefaultValues.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/ParametersWithDefaultValues.values.fir.txt index abf342df8fd..c1a909bd800 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/ParametersWithDefaultValues.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/ParametersWithDefaultValues.values.fir.txt @@ -3,8 +3,8 @@ UFile (package = ) [public final class ParametersWithDefaultValuesKt {...] UMethod (name = foo) [public static final fun foo(a: int, b: java.lang.String, c: int, flag: boolean) : void {...}] UParameter (name = a) [var a: int] UParameter (name = b) [var b: java.lang.String] - UParameter (name = c) [var c: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" - UParameter (name = flag) [var flag: boolean = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UParameter (name = c) [var c: int = 0] + ULiteralExpression (value = 0) [0] = (long)0 + UParameter (name = flag) [var flag: boolean = false] + ULiteralExpression (value = false) [false] = false UBlockExpression [{...}] = Undetermined diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/PropertyReferences.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/PropertyReferences.values.fir.txt index 873b04bfeb2..69a9d465219 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/PropertyReferences.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/PropertyReferences.values.fir.txt @@ -17,8 +17,8 @@ UFile (package = ) [public final class PropertyReferencesKt {...] [!] UnknownKotlinExpression (PREFIX_EXPRESSION) [[!] UnknownKotlinExpression (PREFIX_EXPRESSION)] = Undetermined [!] UnknownKotlinExpression (POSTFIX_EXPRESSION) [[!] UnknownKotlinExpression (POSTFIX_EXPRESSION)] = Undetermined UClass (name = A) [public final class A {...}] - UField (name = privateProp) [private var privateProp: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UField (name = privateProp) [private var privateProp: int = 0] + ULiteralExpression (value = 0) [0] = (long)0 UField (name = mutableProp) [private var mutableProp: int] UMethod (name = A) [public fun A(init: int) {...}] UParameter (name = init) [var init: int] diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/PropertyWithAnnotation.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/PropertyWithAnnotation.values.fir.txt index c4f2b1ae137..c5686bdda01 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/PropertyWithAnnotation.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/PropertyWithAnnotation.values.fir.txt @@ -1,16 +1,16 @@ UFile (package = ) [public final class PropertyWithAnnotationKt {...] UClass (name = PropertyWithAnnotationKt) [public final class PropertyWithAnnotationKt {...}] - UField (name = prop1) [private static final var prop1: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UField (name = prop1) [private static final var prop1: int = 0] + ULiteralExpression (value = 0) [0] = (long)0 UMethod (name = getProp1) [public static final fun getProp1() : int = UastEmptyExpression] UMethod (name = getProp2) [public static final fun getProp2() : int {...}] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return 0] = Nothing + ULiteralExpression (value = 0) [0] = (long)0 UMethod (name = getProp3) [public static final fun getProp3() : int {...}] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return 0] = Nothing + ULiteralExpression (value = 0) [0] = (long)0 UMethod (name = setProp3) [public static final fun setProp3(value: int) : void {...}] UParameter (name = value) [var value: int] UBlockExpression [{...}] = Undetermined diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/StringTemplateComplex.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/StringTemplateComplex.values.fir.txt index 8024d5bcfab..f08d81f836d 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/StringTemplateComplex.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/StringTemplateComplex.values.fir.txt @@ -35,8 +35,8 @@ UFile (package = ) [public final class StringTemplateComplexKt {...] UMethod (name = getLiteralInLiteral2) [public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression] UMethod (name = getEmpty) [public static final fun getEmpty() : java.lang.String = UastEmptyExpression] UMethod (name = simpleForTemplate) [public static final fun simpleForTemplate(i: int) : java.lang.String {...}] - UParameter (name = i) [var i: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UParameter (name = i) [var i: int = 0] + ULiteralExpression (value = 0) [0] = (long)0 UBlockExpression [{...}] = Nothing UReturnExpression [return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] = Nothing [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] = Undetermined diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/StringTemplateComplexForUInjectionHost.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/StringTemplateComplexForUInjectionHost.values.fir.txt index 1ce6cec6e95..95347666668 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/StringTemplateComplexForUInjectionHost.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/StringTemplateComplexForUInjectionHost.values.fir.txt @@ -35,8 +35,8 @@ UFile (package = ) [public final class StringTemplateComplexForUInjectionHostKt UMethod (name = getLiteralInLiteral2) [public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression] UMethod (name = getEmpty) [public static final fun getEmpty() : java.lang.String = UastEmptyExpression] UMethod (name = simpleForTemplate) [public static final fun simpleForTemplate(i: int) : java.lang.String {...}] - UParameter (name = i) [var i: int = "not-yet-compile-time-constant"] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UParameter (name = i) [var i: int = 0] + ULiteralExpression (value = 0) [0] = (long)0 UBlockExpression [{...}] = Nothing UReturnExpression [return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] = Nothing [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] = Undetermined diff --git a/plugins/uast-kotlin-fir/testData/legacyValues/TypeAliasExpansionWithOtherAliasInArgument.values.fir.txt b/plugins/uast-kotlin-fir/testData/legacyValues/TypeAliasExpansionWithOtherAliasInArgument.values.fir.txt index 275d840a669..b4eae4924d1 100644 --- a/plugins/uast-kotlin-fir/testData/legacyValues/TypeAliasExpansionWithOtherAliasInArgument.values.fir.txt +++ b/plugins/uast-kotlin-fir/testData/legacyValues/TypeAliasExpansionWithOtherAliasInArgument.values.fir.txt @@ -4,11 +4,11 @@ UFile (package = ) [public final class TypeAliasExpansionWithOtherAliasInArgumen UParameter (name = $this$foo) [var $this$foo: kotlin.jvm.functions.Function1] UParameter (name = x) [var x: kotlin.jvm.functions.Function1] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return null] = Nothing + ULiteralExpression (value = null) [null] = null UMethod (name = bar) [public static final fun bar($this$bar: java.util.Map, x: java.util.Map) : java.util.Map {...}] UParameter (name = $this$bar) [var $this$bar: java.util.Map] UParameter (name = x) [var x: java.util.Map] UBlockExpression [{...}] = Nothing - UReturnExpression [return "not-yet-compile-time-constant"] = Nothing - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] = "not-yet-compile-time-constant" + UReturnExpression [return null] = Nothing + ULiteralExpression (value = null) [null] = null diff --git a/plugins/uast-kotlin-fir/testData/type/arrayGetAssignMultiIndex.types.fir.txt b/plugins/uast-kotlin-fir/testData/type/arrayGetAssignMultiIndex.types.fir.txt index 6c3cdf47137..a8f427828f2 100644 --- a/plugins/uast-kotlin-fir/testData/type/arrayGetAssignMultiIndex.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/type/arrayGetAssignMultiIndex.types.fir.txt @@ -21,8 +21,8 @@ UFile (package = ) [public final class ArrayGetAssignMultiIndexKt {...] [!] UnknownKotlinExpression (PROPERTY) [[!] UnknownKotlinExpression (PROPERTY)] [!] UnknownKotlinExpression (BINARY_EXPRESSION) [[!] UnknownKotlinExpression (BINARY_EXPRESSION)] [!] UnknownKotlinExpression (BINARY_EXPRESSION) [[!] UnknownKotlinExpression (BINARY_EXPRESSION)] - UReturnExpression [return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION)[[!] UnknownKotlinExpression (PREFIX_EXPRESSION), "not-yet-compile-time-constant"]] : PsiType:Void - UArrayAccessExpression [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)[[!] UnknownKotlinExpression (PREFIX_EXPRESSION), "not-yet-compile-time-constant"]] : PsiType:String + UReturnExpression [return [!] UnknownKotlinExpression (REFERENCE_EXPRESSION)[[!] UnknownKotlinExpression (PREFIX_EXPRESSION), 3]] : PsiType:Void + UArrayAccessExpression [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)[[!] UnknownKotlinExpression (PREFIX_EXPRESSION), 3]] : PsiType:String [!] UnknownKotlinExpression (REFERENCE_EXPRESSION) [[!] UnknownKotlinExpression (REFERENCE_EXPRESSION)] [!] UnknownKotlinExpression (PREFIX_EXPRESSION) [[!] UnknownKotlinExpression (PREFIX_EXPRESSION)] - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:int + ULiteralExpression (value = 3) [3] : PsiType:int diff --git a/plugins/uast-kotlin-fir/testData/type/withGeneric.types.fir.txt b/plugins/uast-kotlin-fir/testData/type/withGeneric.types.fir.txt index 47c9013bdc3..42cb5245fe4 100644 --- a/plugins/uast-kotlin-fir/testData/type/withGeneric.types.fir.txt +++ b/plugins/uast-kotlin-fir/testData/type/withGeneric.types.fir.txt @@ -2,9 +2,9 @@ UFile (package = ) [public final class WithGenericKt {...] UClass (name = WithGenericKt) [public final class WithGenericKt {...}] UMethod (name = test1) [public static final fun test1() : T {...}] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant" as T] - UBinaryExpressionWithType ["not-yet-compile-time-constant" as T] : PsiType:T - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:Void + UReturnExpression [return null as T] + UBinaryExpressionWithType [null as T] : PsiType:T + ULiteralExpression (value = null) [null] : PsiType:Void UTypeReferenceExpression (name = T) [T] UMethod (name = test2) [public static final fun test2() : T {...}] UBlockExpression [{...}] : PsiType:Void @@ -15,9 +15,9 @@ UFile (package = ) [public final class WithGenericKt {...] UTypeReferenceExpression (name = T) [T] UMethod (name = test3) [public static final fun test3() : T {...}] UBlockExpression [{...}] - UReturnExpression [return "not-yet-compile-time-constant" as T] - UBinaryExpressionWithType ["not-yet-compile-time-constant" as T] : PsiType:T - ULiteralExpression (value = "not-yet-compile-time-constant") ["not-yet-compile-time-constant"] : PsiType:Void + UReturnExpression [return null as T] + UBinaryExpressionWithType [null as T] : PsiType:T + ULiteralExpression (value = null) [null] : PsiType:Void UTypeReferenceExpression (name = T) [T] UMethod (name = castToString) [public static final fun castToString(t: T) : void {...}] UParameter (name = t) [var t: T]