Add intention to evaluate compile time expression

#KT-40251 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-09-13 19:17:00 +09:00
committed by klunnii
parent 8cac3f654c
commit d9cf4ee732
37 changed files with 233 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.EvaluateCompileTimeExpressionIntention
@@ -0,0 +1,2 @@
// IS_APPLICABLE: false
val x = <caret>true && false
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with ''b''"
val x = <caret>'a' + 1
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with ''b''"
val x = 'b'
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with ''\n''"
val x = <caret>'\t' + 1
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with ''\n''"
val x = '\n'
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '3.0'"
val x = <caret>1.0 + 2.0
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '3.0'"
val x = 3.0
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Double.NaN'"
val x = <caret>0.0 / 0.0
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Double.NaN'"
val x = Double.NaN
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Double.NEGATIVE_INFINITY'"
val x = <caret>-1.0 / 0.0
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Double.NEGATIVE_INFINITY'"
val x = Double.NEGATIVE_INFINITY
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Double.POSITIVE_INFINITY'"
val x = <caret>1.0 / 0.0
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Double.POSITIVE_INFINITY'"
val x = Double.POSITIVE_INFINITY
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '3.0f'"
val x = <caret>1.0f + 2.0f
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '3.0f'"
val x = 3.0f
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Float.NaN'"
val x = <caret>0.0f / 0.0f
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Float.NaN'"
val x = Float.NaN
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Float.NEGATIVE_INFINITY'"
val x = <caret>-1.0f / 0.0f
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Float.NEGATIVE_INFINITY'"
val x = Float.NEGATIVE_INFINITY
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Float.POSITIVE_INFINITY'"
val x = <caret>1.0f / 0.0f
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with 'Float.POSITIVE_INFINITY'"
val x = Float.POSITIVE_INFINITY
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '5'"
val x = <caret>2 + 3
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '5'"
val x = 5
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '5L'"
val x = 2L + 3L<caret>
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '5L'"
val x = 5L
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '14'"
val x = ((1 + 2) * (-3 + 4))<caret> + (5 + 6)
@@ -0,0 +1,2 @@
// INTENTION_TEXT: "Replace with '14'"
val x = 14
@@ -0,0 +1,2 @@
// IS_APPLICABLE: false
val x = <caret>"a" + "b"
@@ -0,0 +1,3 @@
// IS_APPLICABLE: false
val i = 3
val x = <caret>2 + i