diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/IfThenToSafeAccessIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/IfThenToSafeAccessIntention.kt index 556481bb22b..224a72b95ba 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/IfThenToSafeAccessIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/IfThenToSafeAccessIntention.kt @@ -41,7 +41,12 @@ class IfThenToSafeAccessIntention : SelfTargetingOffsetIndependentIntentionIf-Then foldable to '?.' Replace 'if' expression with safe cast expression + + nullCheckSimple.kt + 2 + light_idea_test_case + + If-Then foldable to '?.' + Remove redundant 'if' expression + diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt index 3072b7bb38d..801539f5d9e 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt @@ -1,5 +1,3 @@ -// IS_APPLICABLE: false - 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/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt.after new file mode 100644 index 00000000000..5ee1caaf8ef --- /dev/null +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/nullCheckSimple.kt.after @@ -0,0 +1,3 @@ +fun foo(arg: Any?): Any? { + return arg +} \ No newline at end of file