Skip to content

Commit f600ee3

Browse files
flofridaySpace Team
authored andcommitted
[FIR] Remove condition evaluation from frontend interpreter
As an experiment there was an implementation to evaluate conditions (behind a flag). However, there are currently no plans to continue in that direction with the frontend interpreter so this feature is now removed. KT-51065
1 parent f12cc1f commit f600ee3

File tree

25 files changed

+11
-224
lines changed

25 files changed

+11
-224
lines changed

analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxTestGenerated.java

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLDiagnosticsFe10TestGenerated.java

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLPartialDiagnosticsFe10TestGenerated.java

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxTestGenerated.java

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedDiagnosticsFe10TestGenerated.java

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/fir/providers/src/org/jetbrains/kotlin/fir/expressions/FirConstChecks.kt

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,11 @@ private class FirConstCheckVisitor(
165165
}
166166

167167
override fun visitWhenExpression(whenExpression: FirWhenExpression, data: Nothing?): ConstantArgumentKind {
168-
if (!whenExpression.isProperlyExhaustive || !intrinsicConstEvaluation) {
169-
return ConstantArgumentKind.NOT_CONST
170-
}
171-
172-
whenExpression.subjectVariable?.initializer?.accept(this, data)?.ifNotValidConst { return it }
173-
for (branch in whenExpression.branches) {
174-
when (branch.condition) {
175-
is FirElseIfTrueCondition -> { /* skip */ }
176-
else -> branch.condition.accept(this, data).ifNotValidConst { return it }
177-
}
178-
branch.result.statements.forEach { stmt ->
179-
if (stmt !is FirExpression) return ConstantArgumentKind.NOT_CONST
180-
stmt.accept(this, data).ifNotValidConst { return it }
181-
}
182-
}
183-
return ConstantArgumentKind.VALID_CONST
168+
return ConstantArgumentKind.NOT_CONST
184169
}
185170

186171
override fun visitWhenSubjectExpression(whenSubjectExpression: FirWhenSubjectExpression, data: Nothing?): ConstantArgumentKind {
187-
return if (intrinsicConstEvaluation) ConstantArgumentKind.VALID_CONST else ConstantArgumentKind.NOT_CONST
172+
return ConstantArgumentKind.NOT_CONST
188173
}
189174

190175
override fun visitLiteralExpression(literalExpression: FirLiteralExpression, data: Nothing?): ConstantArgumentKind {

compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt

Lines changed: 0 additions & 21 deletions
This file was deleted.

compiler/testData/diagnostics/tests/modifiers/const/ifConstVal_before.kt renamed to compiler/testData/diagnostics/tests/modifiers/const/ifConstVal.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN_PIPELINE_TILL: FRONTEND
22
// FIR_IDENTICAL
3-
// LANGUAGE: -IntrinsicConstEvaluation
43

54
const val flag = true
65
const val value = 10

compiler/testData/diagnostics/tests/modifiers/const/ifConstVal_after.fir.kt

Lines changed: 0 additions & 28 deletions
This file was deleted.

compiler/testData/diagnostics/tests/modifiers/const/ifConstVal_after.kt

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)