diff --git a/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/after.kt.template b/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/after.kt.template
deleted file mode 100644
index 693c07d2393..00000000000
--- a/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/after.kt.template
+++ /dev/null
@@ -1 +0,0 @@
-val result = maybeSomething?.perform(something)
diff --git a/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/before.kt.template b/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/before.kt.template
deleted file mode 100644
index 1ff0c342acb..00000000000
--- a/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/before.kt.template
+++ /dev/null
@@ -1 +0,0 @@
-val result = if (maybeSomething != null) maybeSomething.perform(something) else null
diff --git a/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/description.html b/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/description.html
deleted file mode 100644
index 52968f84275..00000000000
--- a/idea/resources/intentionDescriptions/IfThenToSafeAccessIntention/description.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- Converts an if-then expression to an expression that uses a safe-access operator (if applicable)
-
-
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index f09fc29ddd9..cc5f87e3252 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -1620,7 +1620,7 @@
language="kotlin"
/>
- (IfThenToSafeAccessIntention::class) {
- override fun inspectionTarget(element: KtIfExpression) = element.ifKeyword
+class IfThenToSafeAccessInspection : AbstractApplicabilityBasedInspection() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): KtVisitorVoid =
+ object : KtVisitorVoid() {
+ override fun visitIfExpression(expression: KtIfExpression) {
+ super.visitIfExpression(expression)
+ visitTargetElement(expression, holder, isOnTheFly)
+ }
+ }
- override fun problemHighlightType(element: KtIfExpression): ProblemHighlightType =
- if (element.shouldBeTransformed()) super.problemHighlightType(element) else ProblemHighlightType.INFORMATION
-}
-
-class IfThenToSafeAccessIntention : SelfTargetingOffsetIndependentIntention(
- KtIfExpression::class.java, "Replace 'if' expression with safe access expression"
-) {
-
- override fun isApplicableTo(element: KtIfExpression): Boolean {
+ override fun isApplicable(element: KtIfExpression): Boolean {
val ifThenToSelectData = element.buildSelectTransformationData() ?: return false
if (!ifThenToSelectData.receiverExpression.isStable(ifThenToSelectData.context)) return false
- if (ifThenToSelectData.baseClauseEvaluatesToReceiver()) {
- text = if (ifThenToSelectData.condition is KtIsExpression) {
+
+ return ifThenToSelectData.clausesReplaceableBySafeCall()
+ }
+
+ override fun inspectionTarget(element: KtIfExpression) = element.ifKeyword
+
+ override fun inspectionText(element: KtIfExpression) = "Foldable if-then"
+
+ override fun inspectionHighlightType(element: KtIfExpression): ProblemHighlightType =
+ if (element.shouldBeTransformed()) ProblemHighlightType.GENERIC_ERROR_OR_WARNING else ProblemHighlightType.INFORMATION
+
+ override val defaultFixText = "Simplify foldable if-then"
+
+ override fun fixText(element: KtIfExpression) : String {
+ val ifThenToSelectData = element.buildSelectTransformationData()
+ return if (ifThenToSelectData?.baseClauseEvaluatesToReceiver() == true) {
+ if (ifThenToSelectData.condition is KtIsExpression) {
"Replace 'if' expression with safe cast expression"
}
else {
"Remove redundant 'if' expression"
}
}
-
- return ifThenToSelectData.clausesReplaceableBySafeCall()
+ else {
+ "Replace 'if' expression with safe access expression"
+ }
}
- override fun startInWriteAction() = false
+ override val startFixInWriteAction = false
- override fun applyTo(element: KtIfExpression, editor: Editor?) {
- val ifThenToSelectData = element.buildSelectTransformationData() ?: return
+ override fun applyTo(element: PsiElement, project: Project, editor: Editor?) {
+ val ifExpression = element.getParentOfType(true) ?: return
+ val ifThenToSelectData = ifExpression.buildSelectTransformationData() ?: return
- val factory = KtPsiFactory(element)
+ val factory = KtPsiFactory(ifExpression)
val resultExpr = runWriteAction {
val replacedBaseClause = ifThenToSelectData.replacedBaseClause(factory)
- val newExpr = element.replaced(replacedBaseClause)
+ val newExpr = ifExpression.replaced(replacedBaseClause)
KtPsiUtil.deparenthesize(newExpr)
}
diff --git a/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt b/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt
index 66f566178ca..f4dbe201f3c 100644
--- a/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt
@@ -27,12 +27,12 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.core.replaced
import org.jetbrains.kotlin.idea.core.setVisibility
import org.jetbrains.kotlin.idea.inspections.*
+import org.jetbrains.kotlin.idea.inspections.branchedTransformations.IfThenToSafeAccessInspection
import org.jetbrains.kotlin.idea.inspections.conventionNameCalls.ReplaceGetOrSetInspection
import org.jetbrains.kotlin.idea.intentions.*
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnAsymmetricallyIntention
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnIntention
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToElvisIntention
-import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToSafeAccessIntention
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isTrivialStatementBody
import org.jetbrains.kotlin.idea.quickfix.RemoveModifierFix
import org.jetbrains.kotlin.idea.quickfix.RemoveUselessCastFix
@@ -87,7 +87,7 @@ object J2KPostProcessingRegistrar {
registerIntentionBasedProcessing(FoldIfToReturnIntention()) { it.then.isTrivialStatementBody() && it.`else`.isTrivialStatementBody() }
registerIntentionBasedProcessing(FoldIfToReturnAsymmetricallyIntention()) { it.then.isTrivialStatementBody() && (KtPsiUtil.skipTrailingWhitespacesAndComments(it) as KtReturnExpression).returnedExpression.isTrivialStatementBody() }
- registerIntentionBasedProcessing(IfThenToSafeAccessIntention())
+ registerInspectionBasedProcessing(IfThenToSafeAccessInspection())
registerIntentionBasedProcessing(IfThenToElvisIntention())
registerIntentionBasedProcessing(SimplifyNegatedBinaryExpressionIntention())
registerInspectionBasedProcessing(ReplaceGetOrSetInspection())
diff --git a/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/.inspection b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/.inspection
new file mode 100644
index 00000000000..a393fcc31dd
--- /dev/null
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/.inspection
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.inspections.branchedTransformations.IfThenToSafeAccessInspection
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt
similarity index 88%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt
index aeb301bc42f..6b9ae05e4a1 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun doSomething(a: T) {}
fun main(args: Array) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt
similarity index 87%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt
index 33259df89a8..48297e76e73 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
var foo: String? = "foo"
var bar: String? = "bar"
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt
similarity index 83%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt
index dfb67445d55..b911d0a3fa2 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo = "foo"
if (null == null) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt
similarity index 87%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt
index c29ab881c3e..7c7ea92ce45 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
operator fun T.compareTo(a: T): Int = 0
fun main(args: Array) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt
similarity index 88%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt
index 23549502ede..3d941246a49 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
operator fun String?.times(a: Int): Boolean = a == 0
fun main(args: Array) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt
similarity index 87%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt
index b22fa103b29..be61b621b34 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt
@@ -7,7 +7,7 @@ fun doSomething(a: T) {}
fun main(args: Array) {
val foo = maybeFoo()
doSomething(foo)
- if (foo != null) {
+ if (foo != null) {
foo.length
}
else {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt
similarity index 84%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt
index e78849e13b2..9c3288851eb 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt
@@ -5,7 +5,7 @@ fun maybeFoo(): String? {
val x = maybeFoo()
fun main(args: Array) {
- if (x != null) {
+ if (x != null) {
x.length
} else {
null
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyCondition.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyCondition.kt
similarity index 82%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/emptyCondition.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyCondition.kt
index 410f549fae4..a5f122dafe4 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyCondition.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyCondition.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo = "foo"
if () {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyElseBlock.kt
similarity index 88%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyElseBlock.kt
index 141c2ba4744..aaefc70f8f9 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyElseBlock.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun maybeFoo(): String? {
return "foo"
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyThenBlock.kt
similarity index 88%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyThenBlock.kt
index 4c59d0563b2..5121069fac8 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyThenBlock.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun maybeFoo(): String? {
return "foo"
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt
similarity index 84%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt
index 0fa6af278bc..49d64e966e6 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- if (foo != null) {
+ if (foo != null) {
foo.length
}
else {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt
similarity index 83%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt
index 1704670fb88..a1156bac21c 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- if (foo != null)
+ if (foo != null)
foo.length
else
null
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAsExpression.kt
similarity index 80%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAsExpression.kt
index 0c1862c362a..515e686a1da 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAsExpression.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- val x = if (foo == null) {
+ val x = if (foo == null) {
null
}
else {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAsExpression.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAsExpression.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/implicitReceiver.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/implicitReceiver.kt
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/implicitReceiver.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/implicitReceiver.kt
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/implicitReceiver.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/implicitReceiver.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/implicitReceiver.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/implicitReceiver.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/inspectionData/expected.xml b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/inspectionData/expected.xml
similarity index 79%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/inspectionData/expected.xml
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/inspectionData/expected.xml
index 1d229584533..bec92be1bf0 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/inspectionData/expected.xml
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/inspectionData/expected.xml
@@ -5,7 +5,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
rhsEqualsNull.kt
@@ -13,7 +13,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
noThenBlock.kt
@@ -21,7 +21,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
noElseBlock.kt
@@ -29,7 +29,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
lhsNotEqualsNull.kt
@@ -37,7 +37,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
lhsEqualsNull.kt
@@ -45,7 +45,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
ifAsExpression.kt
@@ -53,7 +53,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
ifAndElseNotInBlocks.kt
@@ -61,7 +61,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
ifAndElseBothInBlocks.kt
@@ -69,7 +69,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
doesNotinlineValueOutsideOfScope.kt
@@ -77,7 +77,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
doesNotinlineValueIfUsedMoreThanOnce.kt
@@ -85,7 +85,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
willNotInlineClassProperty.kt
@@ -93,7 +93,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
isCondition.kt
@@ -101,7 +101,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
isNotCondition.kt
@@ -109,7 +109,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
nullCheckWithSelectorCallChain.kt
@@ -117,7 +117,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
isCheckWithSelectorChain.kt
@@ -125,7 +125,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
isCheckSimple.kt
@@ -133,7 +133,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe cast expression
+ Foldable if-then
nullCheckSimple.kt
@@ -141,7 +141,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Remove redundant 'if' expression
+ Foldable if-then
implicitReceiver.kt
@@ -149,7 +149,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe access expression
+ Foldable if-then
property.kt
@@ -157,7 +157,7 @@
light_idea_test_case
If-Then foldable to '?.'
- Replace 'if' expression with safe cast expression
+ Foldable if-then
propertyNotNull.kt
@@ -165,6 +165,6 @@
light_idea_test_case
If-Then foldable to '?.'
- Remove redundant 'if' expression
+ Foldable if-then
diff --git a/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/inspectionData/inspections.test b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/inspectionData/inspections.test
new file mode 100644
index 00000000000..f9f307e9f3c
--- /dev/null
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/inspectionData/inspections.test
@@ -0,0 +1,2 @@
+// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.branchedTransformations.IfThenToSafeAccessInspection
+// WITH_RUNTIME
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isCheckSimple.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckSimple.kt
similarity index 51%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/isCheckSimple.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckSimple.kt
index f55661fb37c..42d609fb141 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/isCheckSimple.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckSimple.kt
@@ -1,5 +1,5 @@
class My(val x: Int)
fun foo(arg: Any?): My? {
- return if (arg is My) arg else null
+ return if (arg is My) arg else null
}
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isCheckSimple.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckSimple.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/isCheckSimple.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckSimple.kt.after
diff --git a/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt
new file mode 100644
index 00000000000..26a4f0de28a
--- /dev/null
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt
@@ -0,0 +1,5 @@
+class My(val x: Int)
+
+fun foo(arg: Any?): Int? {
+ return if (arg is My) arg.x.hashCode() else null
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt.after
diff --git a/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCondition.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCondition.kt
new file mode 100644
index 00000000000..952743e76e3
--- /dev/null
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCondition.kt
@@ -0,0 +1 @@
+fun foo(arg: Any) = if (arg is String) arg.length else null
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isCondition.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCondition.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/isCondition.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCondition.kt.after
diff --git a/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotCondition.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotCondition.kt
new file mode 100644
index 00000000000..96fd6407416
--- /dev/null
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotCondition.kt
@@ -0,0 +1 @@
+fun foo(arg: Any) = if (arg !is String) null else arg.length
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isNotCondition.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotCondition.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/isNotCondition.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotCondition.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isNotNullable.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotNullable.kt
similarity index 74%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/isNotNullable.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotNullable.kt
index bc66928af0c..1959bf35d11 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/isNotNullable.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotNullable.kt
@@ -1,2 +1,2 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(arg: Any) = if (arg !is String?) null else arg?.length
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isNullable.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNullable.kt
similarity index 73%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/isNullable.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNullable.kt
index 627a1637059..f56d6188dd5 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/isNullable.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNullable.kt
@@ -1,2 +1,2 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(arg: Any) = if (arg is String?) arg?.length else null
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsEqualsNull.kt
similarity index 83%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsEqualsNull.kt
index 6f3bbb05e81..deb4b3dce47 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsEqualsNull.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- if (foo == null)
+ if (foo == null)
null
else
foo.length
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt
similarity index 83%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt
index 1704670fb88..69cee4519bd 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- if (foo != null)
+ if (foo != null)
foo.length
else
null
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/missingNecessaryElseClause.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/missingNecessaryElseClause.kt
similarity index 80%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/missingNecessaryElseClause.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/missingNecessaryElseClause.kt
index 6f40921914a..dc8e53b0e94 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/missingNecessaryElseClause.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/missingNecessaryElseClause.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo = null
if (foo == null) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/missingNecessaryThenClause.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/missingNecessaryThenClause.kt
similarity index 80%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/missingNecessaryThenClause.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/missingNecessaryThenClause.kt
index 19e17fa72c1..6165a440d8e 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/missingNecessaryThenClause.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/missingNecessaryThenClause.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo = null
if (foo != null)
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noCondition.kt
similarity index 90%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noCondition.kt
index 1ae9ccd541d..92473a9d522 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noCondition.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
fun main(args: Array) {
val foo: String? = "foo"
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlock.kt
similarity index 81%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlock.kt
index fe5c1033f6d..2235b8f80ac 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlock.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- if (foo != null) {
+ if (foo != null) {
foo.length
}
}
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlock.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlock.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlockAsExpression.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlockAsExpression.kt
similarity index 92%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlockAsExpression.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlockAsExpression.kt
index fde7a017f50..f6be7186d5f 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlockAsExpression.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlockAsExpression.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
// ERROR: 'if' must have both main and 'else' branches if used as an expression
// ERROR: Type mismatch: inferred type is Unit but Int was expected
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noNullInCondition.kt
similarity index 86%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noNullInCondition.kt
index 12cf26a8d30..a6dc46db367 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noNullInCondition.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo: String? = "foo"
val bar: String? = null
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noNullInCondition2.kt
similarity index 86%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noNullInCondition2.kt
index 248646563b1..c41e671a0cc 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noNullInCondition2.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo: String? = "foo"
val bar: String? = null
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noThenBlock.kt
similarity index 78%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noThenBlock.kt
index d7bc397240b..aa352553831 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noThenBlock.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- if (foo == null) else {
+ if (foo == null) else {
foo.length
}
}
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noThenBlock.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noThenBlock.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/notApplicableForFunction.kt
similarity index 87%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/notApplicableForFunction.kt
index cdd13643c7a..865c02a249a 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/notApplicableForFunction.kt
@@ -1,4 +1,4 @@
-//IS_APPLICABLE: false
+// PROBLEM: none
fun maybeFoo(): String? {
return "foo"
}
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt
similarity index 88%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt
index 5c49d8494d4..4bc909e0a6b 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt
@@ -1,4 +1,4 @@
-//IS_APPLICABLE: false
+// PROBLEM: none
fun maybeFoo(): String? {
return "foo"
}
diff --git a/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckSimple.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckSimple.kt
new file mode 100644
index 00000000000..6a86efcb29b
--- /dev/null
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckSimple.kt
@@ -0,0 +1,3 @@
+fun foo(arg: Any?): Any? {
+ return if (arg != null) arg else null
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckSimple.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckSimple.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt
similarity index 71%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt
index 865af0e4326..24ece6ed289 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt
@@ -2,7 +2,7 @@
val nullableString: String? = "abc"
-val foo = if (nullableString != null) {
+val foo = if (nullableString != null) {
nullableString.toUpperCase().toLowerCase()
} else {
null
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt
similarity index 89%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt
index 067df13e6d3..2956af5724b 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun doSomething(a: T) {}
fun main(args: Array) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/property.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/property.kt
similarity index 62%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/property.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/property.kt
index f0c944ad599..bbe586f5d25 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/property.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/property.kt
@@ -1,5 +1,5 @@
-// IS_APPLICABLE: true
-// INTENTION_TEXT: Replace 'if' expression with safe cast expression
+
+// FIX: Replace 'if' expression with safe cast expression
interface Foo
interface Bar : Foo
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/property.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/property.kt.after
similarity index 57%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/property.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/property.kt.after
index 5a3bb590bf9..8a89d21f24a 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/property.kt.after
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/property.kt.after
@@ -1,5 +1,5 @@
-// IS_APPLICABLE: true
-// INTENTION_TEXT: Replace 'if' expression with safe cast expression
+
+// FIX: Replace 'if' expression with safe cast expression
interface Foo
interface Bar : Foo
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/propertyNotNull.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyNotNull.kt
similarity index 64%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/propertyNotNull.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyNotNull.kt
index cd8cdcd6ec2..604dd57b63f 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/propertyNotNull.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyNotNull.kt
@@ -1,5 +1,5 @@
-// IS_APPLICABLE: true
-// INTENTION_TEXT: Remove redundant 'if' expression
+
+// FIX: Remove redundant 'if' expression
interface Bar
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/propertyNotNull.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyNotNull.kt.after
similarity index 56%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/propertyNotNull.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyNotNull.kt.after
index e8513e737e7..111ad21c498 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/propertyNotNull.kt.after
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyNotNull.kt.after
@@ -1,5 +1,5 @@
-// IS_APPLICABLE: true
-// INTENTION_TEXT: Remove redundant 'if' expression
+
+// FIX: Remove redundant 'if' expression
interface Bar
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/propertyWithProperty.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyWithProperty.kt
similarity index 90%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/propertyWithProperty.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyWithProperty.kt
index 60181d3f2db..7778c4b0fb2 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/propertyWithProperty.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyWithProperty.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
interface Foo
interface Bar : Foo {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsEqualsNull.kt
similarity index 83%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsEqualsNull.kt
index 775eda6f9fd..5d861cb9be2 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsEqualsNull.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- if (null == foo)
+ if (null == foo)
null
else
foo.length
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt
similarity index 83%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt
index 1b01ec846fb..8e09ac9556b 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt
@@ -4,7 +4,7 @@ fun maybeFoo(): String? {
fun main(args: Array) {
val foo = maybeFoo()
- if (null != foo)
+ if (null != foo)
foo.length
else
null
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseBothNull.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/thenAndElseBothNull.kt
similarity index 85%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseBothNull.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/thenAndElseBothNull.kt
index 44c0f0cb891..0d5ce46b619 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseBothNull.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/thenAndElseBothNull.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo: String? = "foo"
if (foo == null) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/thenAndElseNotNull.kt
similarity index 91%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/thenAndElseNotNull.kt
index 55734f7f3ce..257523515c2 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/thenAndElseNotNull.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
fun main(args: Array) {
val foo: String? = "foo"
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableEmptyElseBlock.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableEmptyElseBlock.kt
similarity index 84%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableEmptyElseBlock.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableEmptyElseBlock.kt
index 29b3dc79fc4..db397f5d6ac 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableEmptyElseBlock.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableEmptyElseBlock.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo: String? = "foo"
if (foo == null) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableEmptyThenBlock.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableEmptyThenBlock.kt
similarity index 84%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableEmptyThenBlock.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableEmptyThenBlock.kt
index b00af088ac3..5237c7c97ab 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableEmptyThenBlock.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableEmptyThenBlock.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo: String? = "foo"
if (foo != null) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableNoElseBlock.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableNoElseBlock.kt
similarity index 82%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableNoElseBlock.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableNoElseBlock.kt
index 3c6d197adb6..df4a840c668 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableNoElseBlock.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableNoElseBlock.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo: String? = "foo"
if (foo == null) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableNoThenBlock.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableNoThenBlock.kt
similarity index 83%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableNoThenBlock.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableNoThenBlock.kt
index 67741749c64..47e887eb980 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableNoThenBlock.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableNoThenBlock.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun main(args: Array) {
val foo: String? = "foo"
if (foo != null)
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt
similarity index 58%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt
index 1a533cccf84..5877c76807e 100644
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt
+++ b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt
@@ -1,6 +1,6 @@
class F(a: Int?) {
val b = a
- val c = if (b != null) b.toString() else null
+ val c = if (b != null) b.toString() else null
}
fun main(args: Array) {
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt.after b/idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt.after
similarity index 100%
rename from idea/testData/intentions/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt.after
rename to idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt.after
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/.intention b/idea/testData/intentions/branched/ifThenToSafeAccess/.intention
deleted file mode 100644
index 06e588f6449..00000000000
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/.intention
+++ /dev/null
@@ -1 +0,0 @@
-org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToSafeAccessIntention
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/inspectionData/inspections.test b/idea/testData/intentions/branched/ifThenToSafeAccess/inspectionData/inspections.test
deleted file mode 100644
index d4f8867a75a..00000000000
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/inspectionData/inspections.test
+++ /dev/null
@@ -1,2 +0,0 @@
-// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToSafeAccessInspection
-// WITH_RUNTIME
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt
deleted file mode 100644
index 5b50836d765..00000000000
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-class My(val x: Int)
-
-fun foo(arg: Any?): Int? {
- return if (arg is My) arg.x.hashCode() else null
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isCondition.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/isCondition.kt
deleted file mode 100644
index be1017880e1..00000000000
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/isCondition.kt
+++ /dev/null
@@ -1 +0,0 @@
-fun foo(arg: Any) = if (arg is String) arg.length else null
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/isNotCondition.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/isNotCondition.kt
deleted file mode 100644
index 5157a0199c9..00000000000
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/isNotCondition.kt
+++ /dev/null
@@ -1 +0,0 @@
-fun foo(arg: Any) = if (arg !is String) null else arg.length
\ No newline at end of file
diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt
deleted file mode 100644
index 801539f5d9e..00000000000
--- a/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-fun foo(arg: Any?): Any? {
- return if (arg != null) arg else null
-}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java
index 16c0fccf51c..6a2caab7286 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java
@@ -44,12 +44,6 @@ public class InspectionTestGenerated extends AbstractInspectionTest {
doTest(fileName);
}
- @TestMetadata("branched/ifThenToSafeAccess/inspectionData/inspections.test")
- public void testBranched_ifThenToSafeAccess_inspectionData_Inspections_test() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/inspectionData/inspections.test");
- doTest(fileName);
- }
-
@TestMetadata("convertToStringTemplate/inspectionData/inspections.test")
public void testConvertToStringTemplate_inspectionData_Inspections_test() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToStringTemplate/inspectionData/inspections.test");
@@ -488,6 +482,12 @@ public class InspectionTestGenerated extends AbstractInspectionTest {
KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("idea/testData/inspectionsLocal"), Pattern.compile("^(inspections\\.test)$"), TargetBackend.ANY);
}
+ @TestMetadata("branched/ifThenToSafeAccess/inspectionData/inspections.test")
+ public void testBranched_ifThenToSafeAccess_inspectionData_Inspections_test() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/inspectionData/inspections.test");
+ doTest(fileName);
+ }
+
@TestMetadata("conventionNameCalls/replaceGetOrSet/inspectionData/inspections.test")
public void testConventionNameCalls_replaceGetOrSet_inspectionData_Inspections_test() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/inspectionData/inspections.test");
diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
index 4bde56db74c..ded5a552966 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
@@ -51,6 +51,306 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
}
}
+ @TestMetadata("idea/testData/inspectionsLocal/branched")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class Branched extends AbstractLocalInspectionTest {
+ public void testAllFilesPresentInBranched() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/branched"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class IfThenToSafeAccess extends AbstractLocalInspectionTest {
+ public void testAllFilesPresentInIfThenToSafeAccess() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("blockHasMoreThanOneStatement.kt")
+ public void testBlockHasMoreThanOneStatement() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("blockUsesDifferentVar.kt")
+ public void testBlockUsesDifferentVar() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("conditionComparesNullWithNull.kt")
+ public void testConditionComparesNullWithNull() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("conditionInvalidBinaryExp.kt")
+ public void testConditionInvalidBinaryExp() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("conditionNotBinaryExpr.kt")
+ public void testConditionNotBinaryExpr() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("doesNotinlineValueIfUsedMoreThanOnce.kt")
+ public void testDoesNotinlineValueIfUsedMoreThanOnce() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("doesNotinlineValueOutsideOfScope.kt")
+ public void testDoesNotinlineValueOutsideOfScope() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("emptyCondition.kt")
+ public void testEmptyCondition() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyCondition.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("emptyElseBlock.kt")
+ public void testEmptyElseBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyElseBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("emptyThenBlock.kt")
+ public void testEmptyThenBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/emptyThenBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ifAndElseBothInBlocks.kt")
+ public void testIfAndElseBothInBlocks() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ifAndElseNotInBlocks.kt")
+ public void testIfAndElseNotInBlocks() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ifAsExpression.kt")
+ public void testIfAsExpression() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/ifAsExpression.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("implicitReceiver.kt")
+ public void testImplicitReceiver() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/implicitReceiver.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("isCheckSimple.kt")
+ public void testIsCheckSimple() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckSimple.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("isCheckWithSelectorChain.kt")
+ public void testIsCheckWithSelectorChain() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("isCondition.kt")
+ public void testIsCondition() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isCondition.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("isNotCondition.kt")
+ public void testIsNotCondition() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotCondition.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("isNotNullable.kt")
+ public void testIsNotNullable() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNotNullable.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("isNullable.kt")
+ public void testIsNullable() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/isNullable.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lhsEqualsNull.kt")
+ public void testLhsEqualsNull() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsEqualsNull.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lhsNotEqualsNull.kt")
+ public void testLhsNotEqualsNull() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("missingNecessaryElseClause.kt")
+ public void testMissingNecessaryElseClause() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/missingNecessaryElseClause.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("missingNecessaryThenClause.kt")
+ public void testMissingNecessaryThenClause() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/missingNecessaryThenClause.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("noCondition.kt")
+ public void testNoCondition() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noCondition.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("noElseBlock.kt")
+ public void testNoElseBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("noElseBlockAsExpression.kt")
+ public void testNoElseBlockAsExpression() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noElseBlockAsExpression.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("noNullInCondition.kt")
+ public void testNoNullInCondition() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noNullInCondition.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("noNullInCondition2.kt")
+ public void testNoNullInCondition2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noNullInCondition2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("noThenBlock.kt")
+ public void testNoThenBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/noThenBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("notApplicableForFunction.kt")
+ public void testNotApplicableForFunction() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/notApplicableForFunction.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("notApplicableForLocalVar.kt")
+ public void testNotApplicableForLocalVar() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("nullCheckSimple.kt")
+ public void testNullCheckSimple() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckSimple.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("nullCheckWithSelectorCallChain.kt")
+ public void testNullCheckWithSelectorCallChain() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("otherBlockHasMoreThanOneStatement.kt")
+ public void testOtherBlockHasMoreThanOneStatement() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("property.kt")
+ public void testProperty() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/property.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("propertyNotNull.kt")
+ public void testPropertyNotNull() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyNotNull.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("propertyWithProperty.kt")
+ public void testPropertyWithProperty() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/propertyWithProperty.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("rhsEqualsNull.kt")
+ public void testRhsEqualsNull() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsEqualsNull.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("rhsNotEqualsNull.kt")
+ public void testRhsNotEqualsNull() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("thenAndElseBothNull.kt")
+ public void testThenAndElseBothNull() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/thenAndElseBothNull.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("thenAndElseNotNull.kt")
+ public void testThenAndElseNotNull() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/thenAndElseNotNull.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("unacceptableEmptyElseBlock.kt")
+ public void testUnacceptableEmptyElseBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableEmptyElseBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("unacceptableEmptyThenBlock.kt")
+ public void testUnacceptableEmptyThenBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableEmptyThenBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("unacceptableNoElseBlock.kt")
+ public void testUnacceptableNoElseBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableNoElseBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("unacceptableNoThenBlock.kt")
+ public void testUnacceptableNoThenBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/unacceptableNoThenBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("willNotInlineClassProperty.kt")
+ public void testWillNotInlineClassProperty() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt");
+ doTest(fileName);
+ }
+ }
+ }
+
@TestMetadata("idea/testData/inspectionsLocal/canBeVal")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
index a51b7a05743..34a4547967a 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
@@ -1814,297 +1814,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
}
}
- @TestMetadata("idea/testData/intentions/branched/ifThenToSafeAccess")
- @TestDataPath("$PROJECT_ROOT")
- @RunWith(JUnit3RunnerWithInners.class)
- public static class IfThenToSafeAccess extends AbstractIntentionTest {
- public void testAllFilesPresentInIfThenToSafeAccess() throws Exception {
- KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/branched/ifThenToSafeAccess"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
- }
-
- @TestMetadata("blockHasMoreThanOneStatement.kt")
- public void testBlockHasMoreThanOneStatement() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt");
- doTest(fileName);
- }
-
- @TestMetadata("blockUsesDifferentVar.kt")
- public void testBlockUsesDifferentVar() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt");
- doTest(fileName);
- }
-
- @TestMetadata("conditionComparesNullWithNull.kt")
- public void testConditionComparesNullWithNull() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt");
- doTest(fileName);
- }
-
- @TestMetadata("conditionInvalidBinaryExp.kt")
- public void testConditionInvalidBinaryExp() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt");
- doTest(fileName);
- }
-
- @TestMetadata("conditionNotBinaryExpr.kt")
- public void testConditionNotBinaryExpr() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt");
- doTest(fileName);
- }
-
- @TestMetadata("doesNotinlineValueIfUsedMoreThanOnce.kt")
- public void testDoesNotinlineValueIfUsedMoreThanOnce() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt");
- doTest(fileName);
- }
-
- @TestMetadata("doesNotinlineValueOutsideOfScope.kt")
- public void testDoesNotinlineValueOutsideOfScope() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt");
- doTest(fileName);
- }
-
- @TestMetadata("emptyCondition.kt")
- public void testEmptyCondition() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/emptyCondition.kt");
- doTest(fileName);
- }
-
- @TestMetadata("emptyElseBlock.kt")
- public void testEmptyElseBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("emptyThenBlock.kt")
- public void testEmptyThenBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("ifAndElseBothInBlocks.kt")
- public void testIfAndElseBothInBlocks() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt");
- doTest(fileName);
- }
-
- @TestMetadata("ifAndElseNotInBlocks.kt")
- public void testIfAndElseNotInBlocks() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt");
- doTest(fileName);
- }
-
- @TestMetadata("ifAsExpression.kt")
- public void testIfAsExpression() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt");
- doTest(fileName);
- }
-
- @TestMetadata("implicitReceiver.kt")
- public void testImplicitReceiver() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/implicitReceiver.kt");
- doTest(fileName);
- }
-
- @TestMetadata("isCheckSimple.kt")
- public void testIsCheckSimple() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/isCheckSimple.kt");
- doTest(fileName);
- }
-
- @TestMetadata("isCheckWithSelectorChain.kt")
- public void testIsCheckWithSelectorChain() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/isCheckWithSelectorChain.kt");
- doTest(fileName);
- }
-
- @TestMetadata("isCondition.kt")
- public void testIsCondition() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/isCondition.kt");
- doTest(fileName);
- }
-
- @TestMetadata("isNotCondition.kt")
- public void testIsNotCondition() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/isNotCondition.kt");
- doTest(fileName);
- }
-
- @TestMetadata("isNotNullable.kt")
- public void testIsNotNullable() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/isNotNullable.kt");
- doTest(fileName);
- }
-
- @TestMetadata("isNullable.kt")
- public void testIsNullable() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/isNullable.kt");
- doTest(fileName);
- }
-
- @TestMetadata("lhsEqualsNull.kt")
- public void testLhsEqualsNull() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt");
- doTest(fileName);
- }
-
- @TestMetadata("lhsNotEqualsNull.kt")
- public void testLhsNotEqualsNull() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt");
- doTest(fileName);
- }
-
- @TestMetadata("missingNecessaryElseClause.kt")
- public void testMissingNecessaryElseClause() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/missingNecessaryElseClause.kt");
- doTest(fileName);
- }
-
- @TestMetadata("missingNecessaryThenClause.kt")
- public void testMissingNecessaryThenClause() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/missingNecessaryThenClause.kt");
- doTest(fileName);
- }
-
- @TestMetadata("noCondition.kt")
- public void testNoCondition() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt");
- doTest(fileName);
- }
-
- @TestMetadata("noElseBlock.kt")
- public void testNoElseBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("noElseBlockAsExpression.kt")
- public void testNoElseBlockAsExpression() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlockAsExpression.kt");
- doTest(fileName);
- }
-
- @TestMetadata("noNullInCondition.kt")
- public void testNoNullInCondition() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt");
- doTest(fileName);
- }
-
- @TestMetadata("noNullInCondition2.kt")
- public void testNoNullInCondition2() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt");
- doTest(fileName);
- }
-
- @TestMetadata("noThenBlock.kt")
- public void testNoThenBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("notApplicableForFunction.kt")
- public void testNotApplicableForFunction() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt");
- doTest(fileName);
- }
-
- @TestMetadata("notApplicableForLocalVar.kt")
- public void testNotApplicableForLocalVar() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt");
- doTest(fileName);
- }
-
- @TestMetadata("nullCheckSimple.kt")
- public void testNullCheckSimple() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt");
- doTest(fileName);
- }
-
- @TestMetadata("nullCheckWithSelectorCallChain.kt")
- public void testNullCheckWithSelectorCallChain() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt");
- doTest(fileName);
- }
-
- @TestMetadata("otherBlockHasMoreThanOneStatement.kt")
- public void testOtherBlockHasMoreThanOneStatement() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt");
- doTest(fileName);
- }
-
- @TestMetadata("property.kt")
- public void testProperty() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/property.kt");
- doTest(fileName);
- }
-
- @TestMetadata("propertyNotNull.kt")
- public void testPropertyNotNull() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/propertyNotNull.kt");
- doTest(fileName);
- }
-
- @TestMetadata("propertyWithProperty.kt")
- public void testPropertyWithProperty() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/propertyWithProperty.kt");
- doTest(fileName);
- }
-
- @TestMetadata("rhsEqualsNull.kt")
- public void testRhsEqualsNull() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt");
- doTest(fileName);
- }
-
- @TestMetadata("rhsNotEqualsNull.kt")
- public void testRhsNotEqualsNull() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt");
- doTest(fileName);
- }
-
- @TestMetadata("thenAndElseBothNull.kt")
- public void testThenAndElseBothNull() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseBothNull.kt");
- doTest(fileName);
- }
-
- @TestMetadata("thenAndElseNotNull.kt")
- public void testThenAndElseNotNull() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt");
- doTest(fileName);
- }
-
- @TestMetadata("unacceptableEmptyElseBlock.kt")
- public void testUnacceptableEmptyElseBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableEmptyElseBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("unacceptableEmptyThenBlock.kt")
- public void testUnacceptableEmptyThenBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableEmptyThenBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("unacceptableNoElseBlock.kt")
- public void testUnacceptableNoElseBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableNoElseBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("unacceptableNoThenBlock.kt")
- public void testUnacceptableNoThenBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/unacceptableNoThenBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("willNotInlineClassProperty.kt")
- public void testWillNotInlineClassProperty() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/branched/ifThenToSafeAccess/willNotInlineClassProperty.kt");
- doTest(fileName);
- }
- }
-
@TestMetadata("idea/testData/intentions/branched/ifWhen")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)