diff --git a/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/after.kt.template b/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/after.kt.template
new file mode 100644
index 000000000000..9dedd45165f2
--- /dev/null
+++ b/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/after.kt.template
@@ -0,0 +1 @@
+val x = 5
\ No newline at end of file
diff --git a/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/before.kt.template b/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/before.kt.template
new file mode 100644
index 000000000000..60ffe8d2c155
--- /dev/null
+++ b/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/before.kt.template
@@ -0,0 +1 @@
+val x = 2 + 3
\ No newline at end of file
diff --git a/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/description.html b/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/description.html
new file mode 100644
index 000000000000..91c4680d0952
--- /dev/null
+++ b/plugins/kotlin/idea/resources-en/intentionDescriptions/EvaluateCompileTimeExpressionIntention/description.html
@@ -0,0 +1,5 @@
+
+
+This intention replaces compile-time constant expression with its actual value.
+
+
\ No newline at end of file
diff --git a/plugins/kotlin/idea/resources-en/messages/KotlinBundle.properties b/plugins/kotlin/idea/resources-en/messages/KotlinBundle.properties
index d057f7a1b37c..8d1e7d450092 100644
--- a/plugins/kotlin/idea/resources-en/messages/KotlinBundle.properties
+++ b/plugins/kotlin/idea/resources-en/messages/KotlinBundle.properties
@@ -2244,6 +2244,7 @@ inspection.redundant.nullable.return.type.display.name=Redundant nullable return
0.is.always.non.null.type=''{0}'' is always non-null type
inspection.simplifiable.scope.function.display.name=Scope function with nested forEach can be simplified
nested.1.call.in.0.could.be.simplified.to.2=Nested ''{1}'' call in ''{0}'' could be simplified to {2}
+evaluate.compile.time.expression=Evaluate compile-time expression
hints.title.codevision=Code Vision
hints.title.codevision.show.hints.for=Show hints for:
diff --git a/plugins/kotlin/idea/resources/META-INF/inspections.xml b/plugins/kotlin/idea/resources/META-INF/inspections.xml
index 94ebe59bbf5b..7b0cb637905b 100644
--- a/plugins/kotlin/idea/resources/META-INF/inspections.xml
+++ b/plugins/kotlin/idea/resources/META-INF/inspections.xml
@@ -835,6 +835,10 @@
Kotlin
+
+ org.jetbrains.kotlin.idea.intentions.EvaluateCompileTimeExpressionIntention
+ Kotlin
+
diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/EvaluateCompileTimeExpressionIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/EvaluateCompileTimeExpressionIntention.kt
new file mode 100644
index 000000000000..d558159135fc
--- /dev/null
+++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/EvaluateCompileTimeExpressionIntention.kt
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2010-2020 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.intentions
+
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.util.text.StringUtil
+import org.jetbrains.kotlin.KtNodeTypes
+import org.jetbrains.kotlin.idea.KotlinBundle
+import org.jetbrains.kotlin.idea.caches.resolve.analyze
+import org.jetbrains.kotlin.psi.*
+import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
+import org.jetbrains.kotlin.resolve.calls.callUtil.getType
+import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator
+import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
+
+class EvaluateCompileTimeExpressionIntention : SelfTargetingOffsetIndependentIntention(
+ KtBinaryExpression::class.java,
+ KotlinBundle.lazyMessage("evaluate.compile.time.expression")
+) {
+ companion object {
+ val constantNodeTypes = listOf(KtNodeTypes.FLOAT_CONSTANT, KtNodeTypes.CHARACTER_CONSTANT, KtNodeTypes.INTEGER_CONSTANT)
+ }
+
+ override fun isApplicableTo(element: KtBinaryExpression): Boolean {
+ if (element.getStrictParentOfType() != null || !element.isConstantExpression()) return false
+ val constantValue = element.getConstantValue() ?: return false
+ setTextGetter { KotlinBundle.message("replace.with.0", constantValue) }
+ return true
+ }
+
+ override fun applyTo(element: KtBinaryExpression, editor: Editor?) {
+ val constantValue = element.getConstantValue() ?: return
+ element.replace(KtPsiFactory(element).createExpression(constantValue))
+ }
+
+ private fun KtExpression?.isConstantExpression(): Boolean {
+ return when (val expression = KtPsiUtil.deparenthesize(this)) {
+ is KtConstantExpression -> expression.elementType in constantNodeTypes
+ is KtPrefixExpression -> expression.baseExpression.isConstantExpression()
+ is KtBinaryExpression -> expression.left.isConstantExpression() && expression.right.isConstantExpression()
+ else -> false
+ }
+ }
+
+ private fun KtBinaryExpression.getConstantValue(): String? {
+ val context = analyze(BodyResolveMode.PARTIAL)
+ val type = getType(context) ?: return null
+ val constantValue = ConstantExpressionEvaluator.getConstant(this, context)?.toConstantValue(type) ?: return null
+ return when (val value = constantValue.value) {
+ is Char -> "'${StringUtil.escapeStringCharacters(value.toString())}'"
+ is Long -> "${value}L"
+ is Float -> when {
+ value.isNaN() -> "Float.NaN"
+ value.isInfinite() -> if (value > 0.0f) "Float.POSITIVE_INFINITY" else "Float.NEGATIVE_INFINITY"
+ else -> "${value}f"
+ }
+ is Double -> when {
+ value.isNaN() -> "Double.NaN"
+ value.isInfinite() -> if (value > 0.0) "Double.POSITIVE_INFINITY" else "Double.NEGATIVE_INFINITY"
+ else -> value.toString()
+ }
+ else -> value.toString()
+ }
+ }
+}
diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
index acfbe93dd6b9..1ce358bb733e 100644
--- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
+++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
@@ -8154,6 +8154,95 @@ public abstract class IntentionTestGenerated extends AbstractIntentionTest {
}
}
+ @TestMetadata("idea/testData/intentions/evaluateCompileTimeExpression")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class EvaluateCompileTimeExpression extends AbstractIntentionTest {
+ private void runTest(String testDataFilePath) throws Exception {
+ KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
+ }
+
+ @TestMetadata("boolean.kt")
+ public void testBoolean() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/boolean.kt");
+ }
+
+ @TestMetadata("char.kt")
+ public void testChar() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/char.kt");
+ }
+
+ @TestMetadata("char2.kt")
+ public void testChar2() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/char2.kt");
+ }
+
+ @TestMetadata("double.kt")
+ public void testDouble() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/double.kt");
+ }
+
+ @TestMetadata("doubleNaN.kt")
+ public void testDoubleNaN() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/doubleNaN.kt");
+ }
+
+ @TestMetadata("doubleNegativeInfinity.kt")
+ public void testDoubleNegativeInfinity() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/doubleNegativeInfinity.kt");
+ }
+
+ @TestMetadata("doublePositiveInfinity.kt")
+ public void testDoublePositiveInfinity() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/doublePositiveInfinity.kt");
+ }
+
+ @TestMetadata("float.kt")
+ public void testFloat() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/float.kt");
+ }
+
+ @TestMetadata("floatNaN.kt")
+ public void testFloatNaN() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/floatNaN.kt");
+ }
+
+ @TestMetadata("floatNegativeInfinity.kt")
+ public void testFloatNegativeInfinity() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/floatNegativeInfinity.kt");
+ }
+
+ @TestMetadata("floatPositiveInfinity.kt")
+ public void testFloatPositiveInfinity() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/floatPositiveInfinity.kt");
+ }
+
+ @TestMetadata("int.kt")
+ public void testInt() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/int.kt");
+ }
+
+ @TestMetadata("long.kt")
+ public void testLong() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/long.kt");
+ }
+
+ @TestMetadata("parens.kt")
+ public void testParens() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/parens.kt");
+ }
+
+ @TestMetadata("string.kt")
+ public void testString() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/string.kt");
+ }
+
+ @TestMetadata("variable.kt")
+ public void testVariable() throws Exception {
+ runTest("idea/testData/intentions/evaluateCompileTimeExpression/variable.kt");
+ }
+ }
+
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("testData/intentions/expandBooleanExpression")
public static class ExpandBooleanExpression extends AbstractIntentionTest {
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/.intention b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/.intention
new file mode 100644
index 000000000000..368283259365
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/.intention
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.intentions.EvaluateCompileTimeExpressionIntention
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/boolean.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/boolean.kt
new file mode 100644
index 000000000000..1fa713f7183e
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/boolean.kt
@@ -0,0 +1,2 @@
+// IS_APPLICABLE: false
+val x = true && false
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char.kt
new file mode 100644
index 000000000000..b27609a947d8
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with ''b''"
+val x = 'a' + 1
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char.kt.after
new file mode 100644
index 000000000000..722a50d55952
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with ''b''"
+val x = 'b'
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char2.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char2.kt
new file mode 100644
index 000000000000..a80e54a3ca39
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char2.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with ''\n''"
+val x = '\t' + 1
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char2.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char2.kt.after
new file mode 100644
index 000000000000..ebbf98172223
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/char2.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with ''\n''"
+val x = '\n'
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/double.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/double.kt
new file mode 100644
index 000000000000..ad6cbef42e78
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/double.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '3.0'"
+val x = 1.0 + 2.0
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/double.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/double.kt.after
new file mode 100644
index 000000000000..1513af9ca311
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/double.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '3.0'"
+val x = 3.0
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNaN.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNaN.kt
new file mode 100644
index 000000000000..ab9cdf9f096c
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNaN.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Double.NaN'"
+val x = 0.0 / 0.0
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNaN.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNaN.kt.after
new file mode 100644
index 000000000000..4ec99c12278b
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNaN.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Double.NaN'"
+val x = Double.NaN
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNegativeInfinity.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNegativeInfinity.kt
new file mode 100644
index 000000000000..3dfc494a0ce8
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNegativeInfinity.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Double.NEGATIVE_INFINITY'"
+val x = -1.0 / 0.0
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNegativeInfinity.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNegativeInfinity.kt.after
new file mode 100644
index 000000000000..c45a420835ba
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doubleNegativeInfinity.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Double.NEGATIVE_INFINITY'"
+val x = Double.NEGATIVE_INFINITY
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doublePositiveInfinity.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doublePositiveInfinity.kt
new file mode 100644
index 000000000000..62e90436467d
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doublePositiveInfinity.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Double.POSITIVE_INFINITY'"
+val x = 1.0 / 0.0
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doublePositiveInfinity.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doublePositiveInfinity.kt.after
new file mode 100644
index 000000000000..b40db8073ab1
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/doublePositiveInfinity.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Double.POSITIVE_INFINITY'"
+val x = Double.POSITIVE_INFINITY
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/float.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/float.kt
new file mode 100644
index 000000000000..8879d7a149f2
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/float.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '3.0f'"
+val x = 1.0f + 2.0f
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/float.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/float.kt.after
new file mode 100644
index 000000000000..44c74c75e6b4
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/float.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '3.0f'"
+val x = 3.0f
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNaN.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNaN.kt
new file mode 100644
index 000000000000..6fd819ae62ca
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNaN.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Float.NaN'"
+val x = 0.0f / 0.0f
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNaN.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNaN.kt.after
new file mode 100644
index 000000000000..f67aa57d6c19
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNaN.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Float.NaN'"
+val x = Float.NaN
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNegativeInfinity.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNegativeInfinity.kt
new file mode 100644
index 000000000000..f9edfcdea1d3
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNegativeInfinity.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Float.NEGATIVE_INFINITY'"
+val x = -1.0f / 0.0f
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNegativeInfinity.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNegativeInfinity.kt.after
new file mode 100644
index 000000000000..b6ced096feb5
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatNegativeInfinity.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Float.NEGATIVE_INFINITY'"
+val x = Float.NEGATIVE_INFINITY
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatPositiveInfinity.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatPositiveInfinity.kt
new file mode 100644
index 000000000000..c963127e07ae
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatPositiveInfinity.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Float.POSITIVE_INFINITY'"
+val x = 1.0f / 0.0f
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatPositiveInfinity.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatPositiveInfinity.kt.after
new file mode 100644
index 000000000000..58ceb54e1480
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/floatPositiveInfinity.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with 'Float.POSITIVE_INFINITY'"
+val x = Float.POSITIVE_INFINITY
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/int.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/int.kt
new file mode 100644
index 000000000000..f8135efa67b0
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/int.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '5'"
+val x = 2 + 3
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/int.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/int.kt.after
new file mode 100644
index 000000000000..e32c24208feb
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/int.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '5'"
+val x = 5
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/long.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/long.kt
new file mode 100644
index 000000000000..8c1150588371
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/long.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '5L'"
+val x = 2L + 3L
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/long.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/long.kt.after
new file mode 100644
index 000000000000..05aede4db180
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/long.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '5L'"
+val x = 5L
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/parens.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/parens.kt
new file mode 100644
index 000000000000..8052f76eb04e
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/parens.kt
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '14'"
+val x = ((1 + 2) * (-3 + 4)) + (5 + 6)
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/parens.kt.after b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/parens.kt.after
new file mode 100644
index 000000000000..ceb9bbcedbaa
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/parens.kt.after
@@ -0,0 +1,2 @@
+// INTENTION_TEXT: "Replace with '14'"
+val x = 14
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/string.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/string.kt
new file mode 100644
index 000000000000..77ea8f369ccf
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/string.kt
@@ -0,0 +1,2 @@
+// IS_APPLICABLE: false
+val x = "a" + "b"
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/variable.kt b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/variable.kt
new file mode 100644
index 000000000000..8fbe1c0393d5
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/intentions/evaluateCompileTimeExpression/variable.kt
@@ -0,0 +1,3 @@
+// IS_APPLICABLE: false
+val i = 3
+val x = 2 + i