From 41daf993460002f6a071510356f8c2db1f7fa254 Mon Sep 17 00:00:00 2001 From: Dmitry Gridin Date: Mon, 27 May 2019 19:16:34 +0700 Subject: [PATCH] Remove IfThenToDoubleBangIntention Relates to #KT-31502 --- idea/resources/META-INF/plugin-common.xml | 5 - .../after.kt.template | 1 - .../before.kt.template | 1 - .../description.html | 6 - .../intentions/IfThenToDoubleBangIntention.kt | 65 ------ .../branched/ifThenToDoubleBang/.intention | 1 - .../acceptableEmptyElseBlockForStatement.kt | 9 - ...eptableEmptyElseBlockForStatement.kt.after | 4 - .../acceptableEmptyThenBlockForStatement.kt | 9 - ...eptableEmptyThenBlockForStatement.kt.after | 4 - ...ableWithoutElseBlockForStatementWithFun.kt | 8 - ...thoutElseBlockForStatementWithFun.kt.after | 6 - ...ableWithoutElseBlockForStatementWithVal.kt | 7 - ...thoutElseBlockForStatementWithVal.kt.after | 4 - .../applicableForLocalStableVar.kt | 13 -- .../applicableForLocalStableVar.kt.after | 10 - .../blockHasMoreThanOneStatement.kt | 13 -- .../blockUsesDifferentVar.kt | 14 -- .../conditionComparesNullWithNull.kt | 11 - .../conditionInvalidBinaryExp.kt | 14 -- .../conditionNotBinaryExpr.kt | 17 -- .../doesNotinlineValueIfUsedMoreThanOnce.kt | 15 -- ...sNotinlineValueIfUsedMoreThanOnce.kt.after | 10 - .../doesNotinlineValueOutsideOfScope.kt | 14 -- .../doesNotinlineValueOutsideOfScope.kt.after | 10 - .../ifThenToDoubleBang/emptyCondition.kt | 11 - .../ifThenToDoubleBang/emptyElseBlock.kt | 11 - .../ifThenToDoubleBang/emptyThenBlock.kt | 10 - .../ifAndElseBothInBlocks.kt | 14 -- .../ifAndElseBothInBlocks.kt.after | 8 - .../ifAndElseNotInBlocks.kt | 12 -- .../ifAndElseNotInBlocks.kt.after | 8 - .../ifThenToDoubleBang/ifAsExpression.kt | 14 -- .../ifAsExpression.kt.after | 8 - .../ifThenToDoubleBang/lhsEqualsNull.kt | 12 -- .../ifThenToDoubleBang/lhsEqualsNull.kt.after | 8 - .../ifThenToDoubleBang/lhsNotEqualsNull.kt | 12 -- .../lhsNotEqualsNull.kt.after | 8 - .../ifThenToDoubleBang/missingElseClause.kt | 9 - .../ifThenToDoubleBang/missingThenClause.kt | 9 - .../ifThenToDoubleBang/noCondition.kt | 8 - .../ifThenToDoubleBang/noNullInCondition.kt | 12 -- .../notApplicableForFunction.kt | 12 -- .../notApplicableForLocalUnstableVar.kt | 20 -- .../ifThenToDoubleBang/nullBranchAlsoNull.kt | 11 - .../otherBlockHasMoreThanOneStatement.kt | 13 -- .../ifThenToDoubleBang/rhsEqualsNull.kt | 12 -- .../ifThenToDoubleBang/rhsEqualsNull.kt.after | 8 - .../ifThenToDoubleBang/rhsNotEqualsNull.kt | 12 -- .../rhsNotEqualsNull.kt.after | 8 - .../ifThenToDoubleBang/thenAndElseBothNull.kt | 11 - .../branched/ifThenToDoubleBang/this.kt | 2 - .../branched/ifThenToDoubleBang/this.kt.after | 2 - .../ifThenToDoubleBang/throwByFqName.kt | 10 - .../ifThenToDoubleBang/throwByFqName.kt.after | 8 - ...unacceptableEmptyElseBlockForExpression.kt | 10 - ...unacceptableEmptyThenBlockForExpression.kt | 10 - .../willNotInlineClassProperty.kt | 9 - .../willNotInlineClassProperty.kt.after | 9 - .../intentions/IntentionTestGenerated.java | 193 ------------------ 60 files changed, 805 deletions(-) delete mode 100644 idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/after.kt.template delete mode 100644 idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/before.kt.template delete mode 100644 idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/description.html delete mode 100644 idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/IfThenToDoubleBangIntention.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/.intention delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/blockHasMoreThanOneStatement.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/blockUsesDifferentVar.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/conditionComparesNullWithNull.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/conditionNotBinaryExpr.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/emptyCondition.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/emptyElseBlock.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/emptyThenBlock.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/missingElseClause.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/missingThenClause.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/noCondition.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/noNullInCondition.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForFunction.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForLocalUnstableVar.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/nullBranchAlsoNull.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/otherBlockHasMoreThanOneStatement.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/thenAndElseBothNull.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/this.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/this.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt.after delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyElseBlockForExpression.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyThenBlockForExpression.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt delete mode 100644 idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt.after diff --git a/idea/resources/META-INF/plugin-common.xml b/idea/resources/META-INF/plugin-common.xml index 3842152ae22..357f18f019a 100644 --- a/idea/resources/META-INF/plugin-common.xml +++ b/idea/resources/META-INF/plugin-common.xml @@ -953,11 +953,6 @@ Kotlin - - org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToDoubleBangIntention - Kotlin - - org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.ElvisToIfThenIntention Kotlin diff --git a/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/after.kt.template b/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/after.kt.template deleted file mode 100644 index 5d8181f0686..00000000000 --- a/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/after.kt.template +++ /dev/null @@ -1 +0,0 @@ -foo(maybeSomething!!) diff --git a/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/before.kt.template b/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/before.kt.template deleted file mode 100644 index 512b442a380..00000000000 --- a/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/before.kt.template +++ /dev/null @@ -1 +0,0 @@ -foo(if (maybeSomething != null) maybeSomething else throw KotlinNullPointerException()) diff --git a/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/description.html b/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/description.html deleted file mode 100644 index ce323a1e359..00000000000 --- a/idea/resources/intentionDescriptions/IfThenToDoubleBangIntention/description.html +++ /dev/null @@ -1,6 +0,0 @@ - - -This intention converts an if-then expression that checks if a value is null to an equivalent expression - using the !! operator. - - diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/IfThenToDoubleBangIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/IfThenToDoubleBangIntention.kt deleted file mode 100644 index 86a4ad5133d..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/IfThenToDoubleBangIntention.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions - -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.util.TextRange -import org.jetbrains.kotlin.idea.intentions.SelfTargetingRangeIntention -import org.jetbrains.kotlin.idea.intentions.branchedTransformations.* -import org.jetbrains.kotlin.idea.util.application.runWriteAction -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.endOffset -import org.jetbrains.kotlin.psi.psiUtil.startOffset -import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsStatement - -class IfThenToDoubleBangIntention : SelfTargetingRangeIntention( - KtIfExpression::class.java, "Replace 'if' expression with '!!' expression" -) { - override fun applicabilityRange(element: KtIfExpression): TextRange? { - val (context, condition, receiverExpression, baseClause, negatedClause) = element.buildSelectTransformationData() ?: return null - // TODO: here "Replace with as" can be supported - if (condition is KtIsExpression) return null - - val throwExpression = negatedClause as? KtThrowExpression ?: return null - - val matchesAsStatement = element.isUsedAsStatement(context) && (baseClause?.isNullExpressionOrEmptyBlock() ?: true) - if (!matchesAsStatement && - !(baseClause?.evaluatesTo(receiverExpression) ?: false && receiverExpression.isStableSimpleExpression())) return null - - var text = "Replace 'if' expression with '!!' expression" - if (!throwExpression.throwsNullPointerExceptionWithNoArguments()) { - text += " (will remove exception)" - } - - setText(text) - val rParen = element.rightParenthesis ?: return null - return TextRange(element.startOffset, rParen.endOffset) - } - - override fun startInWriteAction() = false - - override fun applyTo(element: KtIfExpression, editor: Editor?) { - val (_, _, receiverExpression) = element.buildSelectTransformationData() ?: return - val result = runWriteAction { - element.replace(KtPsiFactory(element).createExpressionByPattern("$0!!", receiverExpression)) as KtPostfixExpression - } - - if (editor != null) { - result.inlineBaseExpressionIfApplicableWithPrompt(editor) - } - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/.intention b/idea/testData/intentions/branched/ifThenToDoubleBang/.intention deleted file mode 100644 index d9b1de34dcb..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/.intention +++ /dev/null @@ -1 +0,0 @@ -org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToDoubleBangIntention diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt deleted file mode 100644 index 3c3a34f104e..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME -fun main(args: Array) { - val foo: String? = "foo" - if (foo == null) { - throw NullPointerException() - } - else { - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt.after deleted file mode 100644 index ffad6179d63..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt.after +++ /dev/null @@ -1,4 +0,0 @@ -// WITH_RUNTIME -fun main(args: Array) { - "foo"!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt deleted file mode 100644 index 05fd0e101c7..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME -fun main(args: Array) { - val foo: String? = "foo" - if (foo != null) { - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt.after deleted file mode 100644 index ffad6179d63..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt.after +++ /dev/null @@ -1,4 +0,0 @@ -// WITH_RUNTIME -fun main(args: Array) { - "foo"!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt deleted file mode 100644 index 1c13b9edc97..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -fun foo(): Any? = "foo" - -fun main(args: Array) { - if (foo() == null) { - throw KotlinNullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt.after deleted file mode 100644 index fe3b8fdffb8..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt.after +++ /dev/null @@ -1,6 +0,0 @@ -// WITH_RUNTIME -fun foo(): Any? = "foo" - -fun main(args: Array) { - foo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt deleted file mode 100644 index 229fd96b15e..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt +++ /dev/null @@ -1,7 +0,0 @@ -// WITH_RUNTIME -fun main(args: Array) { - val foo: String? = "foo" - if (foo == null) { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt.after deleted file mode 100644 index ffad6179d63..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt.after +++ /dev/null @@ -1,4 +0,0 @@ -// WITH_RUNTIME -fun main(args: Array) { - "foo"!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt deleted file mode 100644 index bf3bc9d7f16..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun test(): String? { - var foo = maybeFoo() - val bar = if (foo == null) - throw NullPointerException() - else - foo - return foo -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt.after deleted file mode 100644 index bd6df0d0229..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun test(): String? { - var foo = maybeFoo() - val bar = foo!! - return foo -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/blockHasMoreThanOneStatement.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/blockHasMoreThanOneStatement.kt deleted file mode 100644 index 76f824e1a4b..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/blockHasMoreThanOneStatement.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = null - - if (foo != null) { - print ("Hello") - foo - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/blockUsesDifferentVar.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/blockUsesDifferentVar.kt deleted file mode 100644 index 070718561b0..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/blockUsesDifferentVar.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo = null - val a = "a" - - if (foo != null) { - a - } - else { - throw NullPointerException() - } - -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/conditionComparesNullWithNull.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/conditionComparesNullWithNull.kt deleted file mode 100644 index a50e26966eb..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/conditionComparesNullWithNull.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = "foo" - if (null == null) { - foo - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt deleted file mode 100644 index 4e93e95c323..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false - -operator fun T.compareTo(a: T): Int = 0 - -fun main(args: Array) { - val foo = null - if (foo > null) { - foo - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/conditionNotBinaryExpr.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/conditionNotBinaryExpr.kt deleted file mode 100644 index 83f78d085a2..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/conditionNotBinaryExpr.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -// ERROR: Type mismatch: inferred type is Int but Boolean was expected -// ERROR: Type mismatch: inferred type is Int but Boolean was expected -// ERROR: Operator call corresponds to a dot-qualified call 'foo.times(10)' which is not allowed on a nullable receiver 'foo'. - -fun String?.times(a: Int): Boolean = a == 0 - -fun main(args: Array) { - val foo: Int? = 4 - if (foo * 10) { - foo - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt deleted file mode 100644 index 5e51472089f..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - print(foo) - if (foo != null) { - foo - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt.after deleted file mode 100644 index 70504aa3c62..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - print(foo) - foo!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt deleted file mode 100644 index 3723c97e398..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -val x = maybeFoo() - -fun main(args: Array) { - if (x != null) { - x - } else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt.after deleted file mode 100644 index 2a21da1d5a0..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -val x = maybeFoo() - -fun main(args: Array) { - x!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/emptyCondition.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/emptyCondition.kt deleted file mode 100644 index 96e4dac05a4..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/emptyCondition.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo = "foo" - if () { - foo - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/emptyElseBlock.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/emptyElseBlock.kt deleted file mode 100644 index 4d07cd4e04b..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/emptyElseBlock.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = null - if (foo != null) { - foo - } - else { - - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/emptyThenBlock.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/emptyThenBlock.kt deleted file mode 100644 index 30080506697..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/emptyThenBlock.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = "foo" - if (foo == null) { - } - else { - foo - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt deleted file mode 100644 index e060d322c99..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - if (foo != null) { - foo - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt.after deleted file mode 100644 index 077fdef6df4..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - maybeFoo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt deleted file mode 100644 index 598056c02e4..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - if (foo != null) - foo - else - throw NullPointerException() -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt.after deleted file mode 100644 index 077fdef6df4..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - maybeFoo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt deleted file mode 100644 index 283d1b87945..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - val x = if (foo == null) { - throw KotlinNullPointerException() - } - else { - foo - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt.after deleted file mode 100644 index 26476f892a9..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val x = maybeFoo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt deleted file mode 100644 index 3f125bf634b..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - if (foo == null) - throw NullPointerException() - else - foo -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt.after deleted file mode 100644 index 077fdef6df4..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - maybeFoo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt deleted file mode 100644 index 9cdc7fa2b72..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - if (foo != null) - foo - else - throw NullPointerException("'foo' must not be null") -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt.after deleted file mode 100644 index 077fdef6df4..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - maybeFoo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/missingElseClause.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/missingElseClause.kt deleted file mode 100644 index 8164fafff31..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/missingElseClause.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = "foo" - if (foo == null) { - null - } -} - diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/missingThenClause.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/missingThenClause.kt deleted file mode 100644 index cd46c98eada..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/missingThenClause.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = "foo" - if (foo == null) - else { - foo - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/noCondition.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/noCondition.kt deleted file mode 100644 index 38fa33c3b29..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/noCondition.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = "foo" - if { - foo - } else throw NullPointerException() -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/noNullInCondition.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/noNullInCondition.kt deleted file mode 100644 index 6c7db8d7147..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/noNullInCondition.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo = "foo" - val bar = "bar" - if (foo == bar) { - foo - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForFunction.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForFunction.kt deleted file mode 100644 index 95fe35bd60f..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForFunction.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -//IS_APPLICABLE: false -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - if (maybeFoo() == null) - maybeFoo() - else - throw NullPointerException() -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForLocalUnstableVar.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForLocalUnstableVar.kt deleted file mode 100644 index 179bbf075c5..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForLocalUnstableVar.kt +++ /dev/null @@ -1,20 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun maybeFoo(): String? { - return "foo" -} - -fun capture(block: () -> Unit): Unit = Unit - -fun main(args: Array) { - var foo = maybeFoo() - - capture { - foo = null - } - - if (foo == null) - throw NullPointerException() - else - foo -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/nullBranchAlsoNull.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/nullBranchAlsoNull.kt deleted file mode 100644 index 6258bc26f71..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/nullBranchAlsoNull.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = "foo" - if (foo == null) { - null - } - else { - foo - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/otherBlockHasMoreThanOneStatement.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/otherBlockHasMoreThanOneStatement.kt deleted file mode 100644 index a4cd8bba130..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/otherBlockHasMoreThanOneStatement.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo: String? = null - - if (foo != null) { - foo - } - else { - print ("Hello") - throw NullPointerException("'foo' must not be null") - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt deleted file mode 100644 index da023b9a123..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - if (null == foo) - throw NullPointerException() - else - foo -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt.after deleted file mode 100644 index 077fdef6df4..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - maybeFoo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt deleted file mode 100644 index 0039f285cdc..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - val foo = maybeFoo() - if (null != foo) - foo - else - throw NullPointerException() -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt.after deleted file mode 100644 index 077fdef6df4..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -fun maybeFoo(): String? { - return "foo" -} - -fun main(args: Array) { - maybeFoo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/thenAndElseBothNull.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/thenAndElseBothNull.kt deleted file mode 100644 index bf1ca8661ef..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/thenAndElseBothNull.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: false -fun main(args: Array) { - val foo = null - if (foo == null) { - null - } - else { - null - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/this.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/this.kt deleted file mode 100644 index 4931e8399f0..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/this.kt +++ /dev/null @@ -1,2 +0,0 @@ -// WITH_RUNTIME -fun String?.foo() = if (this == null) throw NullPointerException() else this \ No newline at end of file diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/this.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/this.kt.after deleted file mode 100644 index cd88e33339e..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/this.kt.after +++ /dev/null @@ -1,2 +0,0 @@ -// WITH_RUNTIME -fun String?.foo() = this!! \ No newline at end of file diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt deleted file mode 100644 index 27fbf30c1c3..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME -class NullPointerException : Exception() - -fun foo(): Any? = "foo" - -fun main(args: Array) { - if (foo() == null) { - throw java.lang.NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt.after deleted file mode 100644 index bbe8a0743b3..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME -class NullPointerException : Exception() - -fun foo(): Any? = "foo" - -fun main(args: Array) { - foo()!! -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyElseBlockForExpression.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyElseBlockForExpression.kt deleted file mode 100644 index 22535edbb39..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyElseBlockForExpression.kt +++ /dev/null @@ -1,10 +0,0 @@ -// IS_APPLICABLE: false -// WITH_RUNTIME -fun main(args: Array) { - val foo: String? = "foo" - val y = if (foo == null) { - throw NullPointerException() - } - else { - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyThenBlockForExpression.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyThenBlockForExpression.kt deleted file mode 100644 index 3442396d4fb..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyThenBlockForExpression.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME -// IS_APPLICABLE: FALSE -fun main(args: Array) { - val foo: String? = "foo" - val y = if (foo == null) { - } - else { - throw NullPointerException() - } -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt b/idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt deleted file mode 100644 index 3501e666e0c..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME -class F(a: Int?) { - val b = a - val c = if (b != null) b else throw NullPointerException() -} - -fun main(args: Array) { - F(1).c -} diff --git a/idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt.after b/idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt.after deleted file mode 100644 index d2cc9074816..00000000000 --- a/idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt.after +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME -class F(a: Int?) { - val b = a - val c = b!! -} - -fun main(args: Array) { - F(1).c -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index 4a528d7e490..1b12058d878 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -2337,199 +2337,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } - @TestMetadata("idea/testData/intentions/branched/ifThenToDoubleBang") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class IfThenToDoubleBang extends AbstractIntentionTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - @TestMetadata("acceptableEmptyElseBlockForStatement.kt") - public void testAcceptableEmptyElseBlockForStatement() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt"); - } - - @TestMetadata("acceptableEmptyThenBlockForStatement.kt") - public void testAcceptableEmptyThenBlockForStatement() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt"); - } - - @TestMetadata("acceptableWithoutElseBlockForStatementWithFun.kt") - public void testAcceptableWithoutElseBlockForStatementWithFun() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt"); - } - - @TestMetadata("acceptableWithoutElseBlockForStatementWithVal.kt") - public void testAcceptableWithoutElseBlockForStatementWithVal() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt"); - } - - public void testAllFilesPresentInIfThenToDoubleBang() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/branched/ifThenToDoubleBang"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); - } - - @TestMetadata("applicableForLocalStableVar.kt") - public void testApplicableForLocalStableVar() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/applicableForLocalStableVar.kt"); - } - - @TestMetadata("blockHasMoreThanOneStatement.kt") - public void testBlockHasMoreThanOneStatement() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/blockHasMoreThanOneStatement.kt"); - } - - @TestMetadata("blockUsesDifferentVar.kt") - public void testBlockUsesDifferentVar() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/blockUsesDifferentVar.kt"); - } - - @TestMetadata("conditionComparesNullWithNull.kt") - public void testConditionComparesNullWithNull() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/conditionComparesNullWithNull.kt"); - } - - @TestMetadata("conditionInvalidBinaryExp.kt") - public void testConditionInvalidBinaryExp() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt"); - } - - @TestMetadata("conditionNotBinaryExpr.kt") - public void testConditionNotBinaryExpr() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/conditionNotBinaryExpr.kt"); - } - - @TestMetadata("doesNotinlineValueIfUsedMoreThanOnce.kt") - public void testDoesNotinlineValueIfUsedMoreThanOnce() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt"); - } - - @TestMetadata("doesNotinlineValueOutsideOfScope.kt") - public void testDoesNotinlineValueOutsideOfScope() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt"); - } - - @TestMetadata("emptyCondition.kt") - public void testEmptyCondition() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/emptyCondition.kt"); - } - - @TestMetadata("emptyElseBlock.kt") - public void testEmptyElseBlock() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/emptyElseBlock.kt"); - } - - @TestMetadata("emptyThenBlock.kt") - public void testEmptyThenBlock() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/emptyThenBlock.kt"); - } - - @TestMetadata("ifAndElseBothInBlocks.kt") - public void testIfAndElseBothInBlocks() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt"); - } - - @TestMetadata("ifAndElseNotInBlocks.kt") - public void testIfAndElseNotInBlocks() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt"); - } - - @TestMetadata("ifAsExpression.kt") - public void testIfAsExpression() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt"); - } - - @TestMetadata("lhsEqualsNull.kt") - public void testLhsEqualsNull() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt"); - } - - @TestMetadata("lhsNotEqualsNull.kt") - public void testLhsNotEqualsNull() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt"); - } - - @TestMetadata("missingElseClause.kt") - public void testMissingElseClause() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/missingElseClause.kt"); - } - - @TestMetadata("missingThenClause.kt") - public void testMissingThenClause() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/missingThenClause.kt"); - } - - @TestMetadata("noCondition.kt") - public void testNoCondition() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/noCondition.kt"); - } - - @TestMetadata("noNullInCondition.kt") - public void testNoNullInCondition() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/noNullInCondition.kt"); - } - - @TestMetadata("notApplicableForFunction.kt") - public void testNotApplicableForFunction() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForFunction.kt"); - } - - @TestMetadata("notApplicableForLocalUnstableVar.kt") - public void testNotApplicableForLocalUnstableVar() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForLocalUnstableVar.kt"); - } - - @TestMetadata("nullBranchAlsoNull.kt") - public void testNullBranchAlsoNull() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/nullBranchAlsoNull.kt"); - } - - @TestMetadata("otherBlockHasMoreThanOneStatement.kt") - public void testOtherBlockHasMoreThanOneStatement() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/otherBlockHasMoreThanOneStatement.kt"); - } - - @TestMetadata("rhsEqualsNull.kt") - public void testRhsEqualsNull() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt"); - } - - @TestMetadata("rhsNotEqualsNull.kt") - public void testRhsNotEqualsNull() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt"); - } - - @TestMetadata("thenAndElseBothNull.kt") - public void testThenAndElseBothNull() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/thenAndElseBothNull.kt"); - } - - @TestMetadata("this.kt") - public void testThis() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/this.kt"); - } - - @TestMetadata("throwByFqName.kt") - public void testThrowByFqName() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt"); - } - - @TestMetadata("unacceptableEmptyElseBlockForExpression.kt") - public void testUnacceptableEmptyElseBlockForExpression() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyElseBlockForExpression.kt"); - } - - @TestMetadata("unacceptableEmptyThenBlockForExpression.kt") - public void testUnacceptableEmptyThenBlockForExpression() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyThenBlockForExpression.kt"); - } - - @TestMetadata("willNotInlineClassProperty.kt") - public void testWillNotInlineClassProperty() throws Exception { - runTest("idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt"); - } - } - @TestMetadata("idea/testData/intentions/branched/ifThenToElvis") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)