diff --git a/idea/resources/inspectionDescriptions/UseExpressionBody.html b/idea/resources/inspectionDescriptions/UseExpressionBody.html
new file mode 100644
index 00000000000..4e19e5c6aa7
--- /dev/null
+++ b/idea/resources/inspectionDescriptions/UseExpressionBody.html
@@ -0,0 +1,5 @@
+
+
+This inspection reports returns (one-liners or whens) replaceable by expression body syntax.
+
+
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index ec1ae803726..434600efd3e 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -853,11 +853,6 @@
Kotlin
-
- org.jetbrains.kotlin.idea.intentions.ConvertToExpressionBodyIntention
- Kotlin
-
-
org.jetbrains.kotlin.idea.intentions.ConvertToBlockBodyIntention
Kotlin
@@ -2376,6 +2371,15 @@
language="kotlin"
/>
+
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UseExpressionBodyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UseExpressionBodyInspection.kt
new file mode 100644
index 00000000000..011ef198cdb
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UseExpressionBodyInspection.kt
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2010-2017 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.inspections
+
+import com.intellij.codeInspection.LocalQuickFix
+import com.intellij.codeInspection.ProblemDescriptor
+import com.intellij.codeInspection.ProblemHighlightType
+import com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING
+import com.intellij.codeInspection.ProblemHighlightType.INFORMATION
+import com.intellij.codeInspection.ProblemsHolder
+import com.intellij.openapi.fileEditor.FileDocumentManager
+import com.intellij.openapi.project.Project
+import com.intellij.psi.PsiElement
+import org.jetbrains.kotlin.builtins.KotlinBuiltIns
+import org.jetbrains.kotlin.idea.caches.resolve.analyze
+import org.jetbrains.kotlin.idea.core.canOmitDeclaredType
+import org.jetbrains.kotlin.idea.core.replaced
+import org.jetbrains.kotlin.idea.core.setType
+import org.jetbrains.kotlin.idea.intentions.hasResultingIfWithoutElse
+import org.jetbrains.kotlin.idea.intentions.resultingWhens
+import org.jetbrains.kotlin.idea.util.CommentSaver
+import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.psi.*
+import org.jetbrains.kotlin.psi.psiUtil.anyDescendantOfType
+import org.jetbrains.kotlin.psi.psiUtil.endOffset
+import org.jetbrains.kotlin.psi.psiUtil.startOffset
+import org.jetbrains.kotlin.resolve.BindingContext
+
+class UseExpressionBodyInspection(private val convertEmptyToUnit: Boolean) : AbstractKotlinInspection() {
+
+ constructor(): this(convertEmptyToUnit = true)
+
+ private data class Status(val toHighlight: PsiElement?, val subject: String, val highlightType: ProblemHighlightType)
+
+ fun isActiveFor(declaration: KtDeclarationWithBody) = statusFor(declaration) != null
+
+ private fun statusFor(declaration: KtDeclarationWithBody): Status? {
+ if (declaration is KtConstructor<*>) return null
+
+ val valueStatement = declaration.findValueStatement() ?: return null
+ val value = valueStatement.getValue()
+ if (value.anyDescendantOfType(
+ canGoInside = { it !is KtFunctionLiteral && it !is KtNamedFunction && it !is KtPropertyAccessor }
+ )) return null
+
+ val toHighlight = valueStatement.toHighlight()
+ return when {
+ valueStatement !is KtReturnExpression -> Status(toHighlight, "block body", INFORMATION)
+ valueStatement.returnedExpression is KtWhenExpression -> Status(toHighlight, "'return when'", GENERIC_ERROR_OR_WARNING)
+ valueStatement.isOneLiner() -> Status(toHighlight, "one-line return", GENERIC_ERROR_OR_WARNING)
+ else -> Status(toHighlight, "return", INFORMATION)
+ }
+ }
+
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) =
+ object : KtVisitorVoid() {
+ override fun visitDeclaration(declaration: KtDeclaration) {
+ super.visitDeclaration(declaration)
+
+ declaration as? KtDeclarationWithBody ?: return
+ val (toHighlight, suffix, highlightType) = statusFor(declaration) ?: return
+
+ val problemDescriptor = holder.manager.createProblemDescriptor(
+ declaration,
+ toHighlight?.textRange?.shiftRight(-declaration.startOffset),
+ "Use expression body instead of $suffix",
+ highlightType,
+ isOnTheFly,
+ ConvertToExpressionBodyFix()
+ )
+ holder.registerProblem(problemDescriptor)
+ }
+ }
+
+ private fun KtExpression.isOneLiner(): Boolean {
+ val file = containingFile?.virtualFile ?: return false
+ val document = FileDocumentManager.getInstance().getDocument(file) ?: return false
+ return document.getLineNumber(textRange.startOffset) == document.getLineNumber(textRange.endOffset)
+ }
+
+ private fun KtDeclarationWithBody.findValueStatement(): KtExpression? {
+ val body = blockExpression() ?: return null
+ return body.findValueStatement()
+ }
+
+ private fun KtDeclarationWithBody.blockExpression() = when (this) {
+ is KtFunctionLiteral -> null
+ else -> if (!hasBlockBody()) null else bodyExpression as? KtBlockExpression
+ }
+
+ private fun KtBlockExpression.findValueStatement(): KtExpression? {
+ val bodyStatements = statements
+ if (bodyStatements.isEmpty()) {
+ return if (convertEmptyToUnit) KtPsiFactory(this).createExpression("Unit") else null
+ }
+ val statement = bodyStatements.singleOrNull() ?: return null
+ when (statement) {
+ is KtReturnExpression -> {
+ return statement
+ }
+
+ //TODO: IMO this is not good code, there should be a way to detect that KtExpression does not have value
+ is KtDeclaration, is KtLoopExpression -> return null
+
+ else -> {
+ // assignment does not have value
+ if (statement is KtBinaryExpression && statement.operationToken in KtTokens.ALL_ASSIGNMENTS) return null
+
+ val context = statement.analyze()
+ val expressionType = context.getType(statement) ?: return null
+ val isUnit = KotlinBuiltIns.isUnit(expressionType)
+ if (!isUnit && !KotlinBuiltIns.isNothing(expressionType)) return null
+ if (isUnit) {
+ if (statement.hasResultingIfWithoutElse()) {
+ return null
+ }
+ val resultingWhens = statement.resultingWhens()
+ if (resultingWhens.any { it.elseExpression == null && context.get(BindingContext.EXHAUSTIVE_WHEN, it) != true }) {
+ return null
+ }
+ }
+ return statement
+ }
+ }
+ }
+
+ private fun KtExpression.getValue() = when (this) {
+ is KtReturnExpression -> returnedExpression
+ else -> null
+ } ?: this
+
+ private fun KtExpression.toHighlight(): PsiElement? = when (this) {
+ is KtReturnExpression -> returnKeyword
+ is KtCallExpression -> calleeExpression
+ is KtQualifiedExpression -> selectorExpression?.toHighlight()
+ is KtObjectLiteralExpression -> objectDeclaration.getObjectKeyword()
+ else -> null
+ }
+
+ fun simplify(declaration: KtDeclarationWithBody, canDeleteTypeRef: Boolean) {
+ val deleteTypeHandler: (KtCallableDeclaration) -> Unit = {
+ it.deleteChildRange(it.colon!!, it.typeReference!!)
+ }
+ simplify(declaration, deleteTypeHandler.takeIf { canDeleteTypeRef })
+ }
+
+ private fun simplify(declaration: KtDeclarationWithBody, deleteTypeHandler: ((KtCallableDeclaration) -> Unit)?) {
+ val block = declaration.blockExpression() ?: return
+ val valueStatement = block.findValueStatement() ?: return
+ val value = valueStatement.getValue()
+
+ if (!declaration.hasDeclaredReturnType() && declaration is KtNamedFunction && block.statements.isNotEmpty()) {
+ val valueType = value.analyze().getType(value)
+ if (valueType == null || !KotlinBuiltIns.isUnit(valueType)) {
+ declaration.setType(KotlinBuiltIns.FQ_NAMES.unit.asString(), shortenReferences = true)
+ }
+ }
+
+ val body = declaration.bodyExpression!!
+
+ val commentSaver = CommentSaver(body)
+
+ declaration.addBefore(KtPsiFactory(declaration).createEQ(), body)
+ val newBody = body.replaced(value)
+
+ commentSaver.restore(newBody)
+
+ if (deleteTypeHandler != null && declaration is KtCallableDeclaration) {
+ if (declaration.hasDeclaredReturnType() && declaration.canOmitDeclaredType(newBody, canChangeTypeToSubtype = true)) {
+ deleteTypeHandler(declaration)
+ }
+ }
+ }
+
+ inner class ConvertToExpressionBodyFix : LocalQuickFix {
+ override fun getFamilyName() = name
+
+ override fun getName() = "Convert to expression body"
+
+ override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
+ val declaration = descriptor.psiElement as? KtDeclarationWithBody ?: return
+ simplify(declaration) {
+ val typeRef = it.typeReference!!
+ val colon = it.colon!!
+ it.findExistingEditor()?.apply {
+ selectionModel.setSelection(colon.startOffset, typeRef.endOffset)
+ caretModel.moveToOffset(typeRef.endOffset)
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToExpressionBodyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToExpressionBodyIntention.kt
deleted file mode 100644
index c8e1ab4cbc8..00000000000
--- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToExpressionBodyIntention.kt
+++ /dev/null
@@ -1,141 +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
-
-import com.intellij.openapi.editor.Editor
-import com.intellij.psi.PsiElement
-import org.jetbrains.kotlin.builtins.KotlinBuiltIns
-import org.jetbrains.kotlin.idea.caches.resolve.analyze
-import org.jetbrains.kotlin.idea.core.canOmitDeclaredType
-import org.jetbrains.kotlin.idea.core.replaced
-import org.jetbrains.kotlin.idea.core.setType
-import org.jetbrains.kotlin.idea.util.CommentSaver
-import org.jetbrains.kotlin.lexer.KtTokens
-import org.jetbrains.kotlin.psi.*
-import org.jetbrains.kotlin.psi.psiUtil.anyDescendantOfType
-import org.jetbrains.kotlin.psi.psiUtil.endOffset
-import org.jetbrains.kotlin.psi.psiUtil.startOffset
-import org.jetbrains.kotlin.resolve.BindingContext
-
-class ConvertToExpressionBodyIntention(
- val convertEmptyToUnit: Boolean = true
-) : SelfTargetingOffsetIndependentIntention(
- KtDeclarationWithBody::class.java, "Convert to expression body"
-) {
- override fun isApplicableTo(element: KtDeclarationWithBody): Boolean {
- if (element is KtConstructor<*>) return false
- val value = calcValue(element) ?: return false
- return !value.anyDescendantOfType(
- canGoInside = { it !is KtFunctionLiteral && it !is KtNamedFunction && it !is KtPropertyAccessor }
- )
- }
-
- override fun allowCaretInsideElement(element: PsiElement) = element !is KtDeclaration
-
- override fun applyTo(element: KtDeclarationWithBody, editor: Editor?) {
- applyTo(element) {
- val typeRef = it.typeReference!!
- val colon = it.colon!!
- editor?.apply {
- selectionModel.setSelection(colon.startOffset, typeRef.endOffset)
- caretModel.moveToOffset(typeRef.endOffset)
- }
- }
- }
-
- fun applyTo(declaration: KtDeclarationWithBody, canDeleteTypeRef: Boolean) {
- val deleteTypeHandler: (KtCallableDeclaration) -> Unit = {
- it.deleteChildRange(it.colon!!, it.typeReference!!)
- }
- applyTo(declaration, deleteTypeHandler.takeIf { canDeleteTypeRef })
- }
-
- private fun applyTo(declaration: KtDeclarationWithBody, deleteTypeHandler: ((KtCallableDeclaration) -> Unit)?) {
- val block = declaration.blockExpression() ?: return
- val value = calcValue(block)!!
-
- if (!declaration.hasDeclaredReturnType() && declaration is KtNamedFunction && block.statements.isNotEmpty()) {
- val valueType = value.analyze().getType(value)
- if (valueType == null || !KotlinBuiltIns.isUnit(valueType)) {
- declaration.setType(KotlinBuiltIns.FQ_NAMES.unit.asString(), shortenReferences = true)
- }
- }
-
- val body = declaration.bodyExpression!!
-
- val commentSaver = CommentSaver(body)
-
- declaration.addBefore(KtPsiFactory(declaration).createEQ(), body)
- val newBody = body.replaced(value)
-
- commentSaver.restore(newBody)
-
- if (deleteTypeHandler != null && declaration is KtCallableDeclaration) {
- if (declaration.hasDeclaredReturnType() && declaration.canOmitDeclaredType(newBody, canChangeTypeToSubtype = true)) {
- deleteTypeHandler(declaration)
- }
- }
- }
-
- private fun KtDeclarationWithBody.blockExpression() = when (this) {
- is KtFunctionLiteral -> null
- else -> {
- val body = bodyExpression
- if (!hasBlockBody() || body !is KtBlockExpression) null else body
- }
- }
-
- private fun calcValue(declaration: KtDeclarationWithBody): KtExpression? {
- val body = declaration.blockExpression() ?: return null
- return calcValue(body)
- }
-
- private fun calcValue(body: KtBlockExpression): KtExpression? {
- val bodyStatements = body.statements
- if (bodyStatements.isEmpty()) {
- return if (convertEmptyToUnit) KtPsiFactory(body).createExpression("Unit") else null
- }
- val statement = bodyStatements.singleOrNull() ?: return null
- when (statement) {
- is KtReturnExpression -> {
- return statement.returnedExpression
- }
-
- //TODO: IMO this is not good code, there should be a way to detect that JetExpression does not have value
- is KtDeclaration, is KtLoopExpression -> return null // is JetExpression but does not have value
-
- else -> {
- if (statement is KtBinaryExpression && statement.operationToken in KtTokens.ALL_ASSIGNMENTS) return null // assignment does not have value
-
- val context = statement.analyze()
- val expressionType = context.getType(statement) ?: return null
- val isUnit = KotlinBuiltIns.isUnit(expressionType)
- if (!isUnit && !KotlinBuiltIns.isNothing(expressionType)) return null
- if (isUnit) {
- if (statement.hasResultingIfWithoutElse()) {
- return null
- }
- val resultingWhens = statement.resultingWhens()
- if (resultingWhens.any { it.elseExpression == null && context.get(BindingContext.EXHAUSTIVE_WHEN, it) != true }) {
- return null
- }
- }
- return statement
- }
- }
- }
-}
diff --git a/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt b/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt
index a01f22deb4d..212f72a67d3 100644
--- a/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt
@@ -26,6 +26,7 @@ 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.RedundantSamConstructorInspection
+import org.jetbrains.kotlin.idea.inspections.UseExpressionBodyInspection
import org.jetbrains.kotlin.idea.intentions.*
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnAsymmetricallyIntention
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnIntention
@@ -78,8 +79,7 @@ object J2KPostProcessingRegistrar {
_processings.add(UnresolvedVariableReferenceFromInitializerToThisReferenceProcessing())
_processings.add(RemoveRedundantSamAdaptersProcessing())
_processings.add(RemoveRedundantCastToNullableProcessing())
-
- registerIntentionBasedProcessing(ConvertToExpressionBodyIntention(convertEmptyToUnit = false)) { it is KtPropertyAccessor }
+ _processings.add(UseExpressionBodyProcessing())
registerIntentionBasedProcessing(FoldInitializerAndIfToElvisIntention())
@@ -256,6 +256,19 @@ object J2KPostProcessingRegistrar {
}
}
+ private class UseExpressionBodyProcessing : J2kPostProcessing {
+ override fun createAction(element: KtElement, diagnostics: Diagnostics): (() -> Unit)? {
+ if (element !is KtPropertyAccessor) return null
+
+ val inspection = UseExpressionBodyInspection(convertEmptyToUnit = false)
+ if (!inspection.isActiveFor(element)) return null
+
+ return {
+ inspection.simplify(element, false)
+ }
+ }
+ }
+
private class RemoveRedundantCastToNullableProcessing : J2kPostProcessing {
override fun createAction(element: KtElement, diagnostics: Diagnostics): (() -> Unit)? {
if (element !is KtBinaryExpressionWithTypeRHS) return null
diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractorUtil.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractorUtil.kt
index cdb76334a10..4a7c2c37107 100644
--- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractorUtil.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractorUtil.kt
@@ -25,7 +25,7 @@ import com.intellij.refactoring.BaseRefactoringProcessor
import org.jetbrains.kotlin.builtins.isFunctionType
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.idea.core.*
-import org.jetbrains.kotlin.idea.intentions.ConvertToExpressionBodyIntention
+import org.jetbrains.kotlin.idea.inspections.UseExpressionBodyInspection
import org.jetbrains.kotlin.idea.intentions.InfixCallToOrdinaryIntention
import org.jetbrains.kotlin.idea.intentions.OperatorToFunctionIntention
import org.jetbrains.kotlin.idea.intentions.RemoveExplicitTypeArgumentsIntention
@@ -552,11 +552,11 @@ fun ExtractionGeneratorConfiguration.generateDeclaration(
}
if (generatorOptions.allowExpressionBody) {
- val convertToExpressionBody = ConvertToExpressionBodyIntention()
val bodyExpression = body.statements.singleOrNull()
val bodyOwner = body.parent as KtDeclarationWithBody
- if (bodyExpression != null && !bodyExpression.isMultiLine() && convertToExpressionBody.isApplicableTo(bodyOwner)) {
- convertToExpressionBody.applyTo(bodyOwner, !descriptor.returnType.isFlexible())
+ val useExpressionBodyInspection = UseExpressionBodyInspection()
+ if (bodyExpression != null && !bodyExpression.isMultiLine() && useExpressionBodyInspection.isActiveFor(bodyOwner)) {
+ useExpressionBodyInspection.simplify(bodyOwner, !descriptor.returnType.isFlexible())
}
}
}
diff --git a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterIsEmpty.kt b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterIsEmpty.kt
index 4c2a249d736..71bd67d475e 100644
--- a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterIsEmpty.kt
+++ b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterIsEmpty.kt
@@ -1,3 +1,3 @@
// WITH_RUNTIME
-val x = listOf(1, 2, 3).filter { it % 2 != 0 }.isEmpty()
\ No newline at end of file
+val x = listOf(1, 2, 3).filter { it % 2 != 0 }.isEmpty()
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterIsNotEmpty.kt b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterIsNotEmpty.kt
index 8d096627a7d..fbbb8aacec1 100644
--- a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterIsNotEmpty.kt
+++ b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterIsNotEmpty.kt
@@ -1,3 +1,3 @@
// WITH_RUNTIME
-val x = listOf(1, 2, 3).filter { it % 2 != 0 }.isNotEmpty()
\ No newline at end of file
+val x = listOf(1, 2, 3).filter { it % 2 != 0 }.isNotEmpty()
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterLastExplicit.kt b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterLastExplicit.kt
index 43ad7e5fb7d..3d757c490ac 100644
--- a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterLastExplicit.kt
+++ b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterLastExplicit.kt
@@ -1,3 +1,3 @@
// WITH_RUNTIME
-val x = listOf("1", "").filter { element -> element.isNotEmpty() }.last()
\ No newline at end of file
+val x = listOf("1", "").filter { element -> element.isNotEmpty() }.last()
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterTextSingleOrNull.kt b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterTextSingleOrNull.kt
index caea5be3bba..f1b9dc23c3d 100644
--- a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterTextSingleOrNull.kt
+++ b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/filterTextSingleOrNull.kt
@@ -1,3 +1,3 @@
// WITH_RUNTIME
-val x = "5abc".filter { it.isDigit() }.singleOrNull()
\ No newline at end of file
+val x = "5abc".filter { it.isDigit() }.singleOrNull()
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinTo.kt b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinTo.kt
index 9939c2b031d..4e475ab8148 100644
--- a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinTo.kt
+++ b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinTo.kt
@@ -1,4 +1,4 @@
// WITH_RUNTIME
val sb = StringBuilder()
-val x = listOf(1, 2, 3).map { "$it*$it" }.joinTo(buffer = sb, prefix = "= ", separator = " + ")
\ No newline at end of file
+val x = listOf(1, 2, 3).map { "$it*$it" }.joinTo(buffer = sb, prefix = "= ", separator = " + ")
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinToString.kt b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinToString.kt
index e97fabddcd3..a98839c5208 100644
--- a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinToString.kt
+++ b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinToString.kt
@@ -1,3 +1,3 @@
// WITH_RUNTIME
-val x = listOf(1, 2, 3).map { "$it*$it" }.joinToString(prefix = "= ", separator = " + ")
\ No newline at end of file
+val x = listOf(1, 2, 3).map { "$it*$it" }.joinToString(prefix = "= ", separator = " + ")
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinToStringWithReference.kt b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinToStringWithReference.kt
index 84a8b81b215..be19a7bd762 100644
--- a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinToStringWithReference.kt
+++ b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/joinToStringWithReference.kt
@@ -1,3 +1,3 @@
// WITH_RUNTIME
-val x = listOf(1, 2, 3).map(Int::toString).joinToString(prefix = "= ", separator = " + ")
\ No newline at end of file
+val x = listOf(1, 2, 3).map(Int::toString).joinToString(prefix = "= ", separator = " + ")
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/mapNotNull.kt b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/mapNotNull.kt
index 4e06e43850a..a414a46d8cc 100644
--- a/idea/testData/inspectionsLocal/collections/simplifiableCallChain/mapNotNull.kt
+++ b/idea/testData/inspectionsLocal/collections/simplifiableCallChain/mapNotNull.kt
@@ -1,3 +1,3 @@
// WITH_RUNTIME
-val x = listOf(1, 0, 2).map { if (it != 0) it else null }.filterNotNull()
\ No newline at end of file
+val x = listOf(1, 0, 2).map { if (it != 0) it else null }.filterNotNull()
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/basic.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/basic.kt
index 70a5c07313e..294e5aca2a4 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/basic.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/basic.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: String) {}
fun bar() {
- foo(*arrayOf("abc"))
+ foo(*arrayOf("abc"))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/booleanArrayOf.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/booleanArrayOf.kt
index 3107b73896e..d105c8fe09f 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/booleanArrayOf.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/booleanArrayOf.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: Boolean) {}
fun bar() {
- foo(*booleanArrayOf(true, true))
+ foo(*booleanArrayOf(true, true))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/byteArrayOf.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/byteArrayOf.kt
index 19f5b7c96ef..97f71c32f32 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/byteArrayOf.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/byteArrayOf.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: Byte) {}
fun bar() {
- foo(*byteArrayOf(1))
+ foo(*byteArrayOf(1))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/charArrayOf.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/charArrayOf.kt
index c15915c818d..0d36096b411 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/charArrayOf.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/charArrayOf.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: Char) {}
fun bar() {
- foo(*charArrayOf('a', 'b'))
+ foo(*charArrayOf('a', 'b'))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/doubleArrayOf.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/doubleArrayOf.kt
index 90dabad7a9a..f66d48f9c11 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/doubleArrayOf.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/doubleArrayOf.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: Double) {}
fun bar() {
- foo(*doubleArrayOf(1.0))
+ foo(*doubleArrayOf(1.0))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/emptyArray.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/emptyArray.kt
index 390fdf9754b..c6cb5b0964f 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/emptyArray.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/emptyArray.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: String) {}
fun bar() {
- foo(*emptyArray())
+ foo(*emptyArray())
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/floatArrayOf.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/floatArrayOf.kt
index deef891a6ca..69f357befaf 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/floatArrayOf.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/floatArrayOf.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: Float) {}
fun bar() {
- foo(*floatArrayOf(1.0f))
+ foo(*floatArrayOf(1.0f))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/intArrayOf.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/intArrayOf.kt
index 0f38779a460..c13c2f95181 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/intArrayOf.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/intArrayOf.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: Int) {}
fun bar() {
- foo(*intArrayOf(1))
+ foo(*intArrayOf(1))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/longArrayOf.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/longArrayOf.kt
index 391c330f745..b2ad1f3cd1f 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/longArrayOf.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/longArrayOf.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: Long) {}
fun bar() {
- foo(*longArrayOf(1L))
+ foo(*longArrayOf(1L))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/multipleValues.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/multipleValues.kt
index cd348b7db30..13915f6b95a 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/multipleValues.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/multipleValues.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: String) {}
fun bar() {
- foo(*arrayOf("abc", "def"))
+ foo(*arrayOf("abc", "def"))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/multipleValuesWithOtherValues.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/multipleValuesWithOtherValues.kt
index bb0119420e1..9a147edc4e4 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/multipleValuesWithOtherValues.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/multipleValuesWithOtherValues.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: String) {}
fun bar() {
- foo(*arrayOf("abc", "def"), "ghi", "jkl")
+ foo(*arrayOf("abc", "def"), "ghi", "jkl")
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/namedArgumentForArray.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/namedArgumentForArray.kt
index 035bbf2a92c..0ff9f40f341 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/namedArgumentForArray.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/namedArgumentForArray.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: String) {}
fun bar() {
- foo(*arrayOf(elements = "abc"))
+ foo(*arrayOf(elements = "abc"))
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/noParams.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/noParams.kt
index e04d85bf7d9..10497ee5da2 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/noParams.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/noParams.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: String) {}
fun bar() {
- foo(*arrayOf())
+ foo(*arrayOf())
}
diff --git a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/shortArrayOf.kt b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/shortArrayOf.kt
index 6c537271428..f4690fdfe84 100644
--- a/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/shortArrayOf.kt
+++ b/idea/testData/inspectionsLocal/removeRedundantSpreadOperator/shortArrayOf.kt
@@ -1,5 +1,5 @@
fun foo(vararg x: Short) {}
fun bar() {
- foo(*shortArrayOf(1))
+ foo(*shortArrayOf(1))
}
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/.inspection b/idea/testData/inspectionsLocal/useExpressionBody/.inspection
new file mode 100644
index 00000000000..f0137474a83
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/.inspection
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.inspections.UseExpressionBodyInspection
\ No newline at end of file
diff --git a/idea/testData/intentions/convertToExpressionBody/anonymousObjectExpression.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/anonymousObjectExpression.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/anonymousObjectExpression.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/anonymousObjectExpression.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/anonymousObjectExpression.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/anonymousObjectExpression.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/anonymousObjectExpression.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/anonymousObjectExpression.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/assignPlus.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/assignPlus.kt
similarity index 64%
rename from idea/testData/intentions/convertToExpressionBody/assignPlus.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/assignPlus.kt
index 1a835b6433e..54535401341 100644
--- a/idea/testData/intentions/convertToExpressionBody/assignPlus.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/assignPlus.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
var x = 0
diff --git a/idea/testData/intentions/convertToExpressionBody/assignment.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/assignment.kt
similarity index 68%
rename from idea/testData/intentions/convertToExpressionBody/assignment.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/assignment.kt
index a39404cac4d..9eea440d0b2 100644
--- a/idea/testData/intentions/convertToExpressionBody/assignment.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/assignment.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
var a = 1
var b = 2
diff --git a/idea/testData/intentions/convertToExpressionBody/constructorWithEmptyBody.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/constructorWithEmptyBody.kt
similarity index 62%
rename from idea/testData/intentions/convertToExpressionBody/constructorWithEmptyBody.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/constructorWithEmptyBody.kt
index 590744d01a1..55b6b3fac76 100644
--- a/idea/testData/intentions/convertToExpressionBody/constructorWithEmptyBody.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/constructorWithEmptyBody.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
class C {
constructor() {}
diff --git a/idea/testData/intentions/convertToExpressionBody/declaration.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/declaration.kt
similarity index 59%
rename from idea/testData/intentions/convertToExpressionBody/declaration.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/declaration.kt
index 564c3d52147..666030ee0e3 100644
--- a/idea/testData/intentions/convertToExpressionBody/declaration.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/declaration.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo() {
val v = 1
diff --git a/idea/testData/intentions/convertToExpressionBody/elvisIfElseUnit.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfElseUnit.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/elvisIfElseUnit.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfElseUnit.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/elvisIfElseUnit.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfElseUnit.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/elvisIfElseUnit.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfElseUnit.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/elvisIfUnit.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfUnit.kt
similarity index 79%
rename from idea/testData/intentions/convertToExpressionBody/elvisIfUnit.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfUnit.kt
index 0fd4a72843e..68d77755e4c 100644
--- a/idea/testData/intentions/convertToExpressionBody/elvisIfUnit.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfUnit.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun nullable() {}
diff --git a/idea/testData/intentions/convertToExpressionBody/elvisWhenUnitNonExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisWhenUnitNonExhaustive.kt
similarity index 91%
rename from idea/testData/intentions/convertToExpressionBody/elvisWhenUnitNonExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisWhenUnitNonExhaustive.kt
index a7a7754e6ef..82cbd9c78f7 100644
--- a/idea/testData/intentions/convertToExpressionBody/elvisWhenUnitNonExhaustive.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisWhenUnitNonExhaustive.kt
@@ -1,4 +1,5 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
+
enum class AccessMode { READ, WRITE, RW }
fun whenExpr(access: AccessMode) {
println("result") ?: when (access) {
diff --git a/idea/testData/intentions/convertToExpressionBody/emptyList.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/emptyList.kt
similarity index 59%
rename from idea/testData/intentions/convertToExpressionBody/emptyList.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/emptyList.kt
index 142a540ddcb..f133ee599cb 100644
--- a/idea/testData/intentions/convertToExpressionBody/emptyList.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/emptyList.kt
@@ -1,5 +1,5 @@
// WITH_RUNTIME
fun foo(): List {
- return emptyList()
+ return emptyList()
}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/emptyList.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/emptyList.kt.after
new file mode 100644
index 00000000000..2d22b9e49a8
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/emptyList.kt.after
@@ -0,0 +1,3 @@
+// WITH_RUNTIME
+
+fun foo(): List = emptyList()
\ No newline at end of file
diff --git a/idea/testData/intentions/convertToExpressionBody/expressionWithReturns1.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/expressionWithReturns1.kt
similarity index 80%
rename from idea/testData/intentions/convertToExpressionBody/expressionWithReturns1.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/expressionWithReturns1.kt
index 7b20bdbd2b8..2d592f09815 100644
--- a/idea/testData/intentions/convertToExpressionBody/expressionWithReturns1.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/expressionWithReturns1.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(p: Boolean): String {
return bar() ?: return "a"
diff --git a/idea/testData/intentions/convertToExpressionBody/expressionWithReturns2.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/expressionWithReturns2.kt
similarity index 82%
rename from idea/testData/intentions/convertToExpressionBody/expressionWithReturns2.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/expressionWithReturns2.kt
index 81d12807865..f62f1e34bad 100644
--- a/idea/testData/intentions/convertToExpressionBody/expressionWithReturns2.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/expressionWithReturns2.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(p: Boolean): String {
if (p) {
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithEmptyBody.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithEmptyBody.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithEmptyBody.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithEmptyBody.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithEmptyBody2.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody2.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithEmptyBody2.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody2.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithEmptyBody2.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody2.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithEmptyBody2.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody2.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithNoBlock.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNoBlock.kt
similarity index 51%
rename from idea/testData/intentions/convertToExpressionBody/funWithNoBlock.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNoBlock.kt
index 416bf972359..1e4488f60eb 100644
--- a/idea/testData/intentions/convertToExpressionBody/funWithNoBlock.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNoBlock.kt
@@ -1,3 +1,3 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo() = "abc"
\ No newline at end of file
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithNothingType.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNothingType.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithNothingType.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNothingType.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithNothingType.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNothingType.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithNothingType.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNothingType.kt.after
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithReturn.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithReturn.kt
new file mode 100644
index 00000000000..90fb86deaa5
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithReturn.kt
@@ -0,0 +1,3 @@
+fun foo(): String {
+ return "abc"
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithReturn.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithReturn.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithReturn.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithReturn.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithUnitType.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithUnitType.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithUnitType.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithUnitType.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithUnitType2.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType2.kt
similarity index 70%
rename from idea/testData/intentions/convertToExpressionBody/funWithUnitType2.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType2.kt
index ffbebeec3a3..abc3f57640a 100644
--- a/idea/testData/intentions/convertToExpressionBody/funWithUnitType2.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType2.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo() {
bar()
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithUnitTypeWithThrow.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitTypeWithThrow.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithUnitTypeWithThrow.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitTypeWithThrow.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithUnitTypeWithThrow.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitTypeWithThrow.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/funWithUnitTypeWithThrow.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitTypeWithThrow.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/functionLiteral.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/functionLiteral.kt
similarity index 78%
rename from idea/testData/intentions/convertToExpressionBody/functionLiteral.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/functionLiteral.kt
index c73634d9218..73bb85de121 100644
--- a/idea/testData/intentions/convertToExpressionBody/functionLiteral.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/functionLiteral.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(handler: () -> Unit) { }
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/getWithReturn.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/getWithReturn.kt
new file mode 100644
index 00000000000..533b47eb364
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/getWithReturn.kt
@@ -0,0 +1,4 @@
+val foo: String
+ get() {
+ return "abc"
+ }
\ No newline at end of file
diff --git a/idea/testData/intentions/convertToExpressionBody/getWithReturn.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/getWithReturn.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/getWithReturn.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/getWithReturn.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/ifElseUnit.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifElseUnit.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/ifElseUnit.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifElseUnit.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/ifElseUnit.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifElseUnit.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/ifElseUnit.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifElseUnit.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/ifUnit.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifUnit.kt
similarity index 72%
rename from idea/testData/intentions/convertToExpressionBody/ifUnit.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifUnit.kt
index 09b9ab321ee..53b38487c0e 100644
--- a/idea/testData/intentions/convertToExpressionBody/ifUnit.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifUnit.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun bar() {}
diff --git a/idea/testData/intentions/convertToExpressionBody/ifWhenUnitExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitExhaustive.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/ifWhenUnitExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitExhaustive.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/ifWhenUnitExhaustive.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitExhaustive.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/ifWhenUnitExhaustive.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitExhaustive.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/ifWhenUnitNonExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitNonExhaustive.kt
similarity index 95%
rename from idea/testData/intentions/convertToExpressionBody/ifWhenUnitNonExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitNonExhaustive.kt
index 352dc96d68c..8123adc8658 100644
--- a/idea/testData/intentions/convertToExpressionBody/ifWhenUnitNonExhaustive.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitNonExhaustive.kt
@@ -1,4 +1,5 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
+
enum class AccessMode { READ, WRITE, RW }
fun whenExpr(mode: Boolean, access: AccessMode) {
if (mode) {
diff --git a/idea/testData/intentions/convertToExpressionBody/keepComments/1.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/1.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/keepComments/1.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/1.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/keepComments/1.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/1.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/keepComments/1.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/1.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/keepComments/2.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/2.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/keepComments/2.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/2.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/keepComments/2.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/2.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/keepComments/2.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/2.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/keepComments/3.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/3.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/keepComments/3.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/3.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/keepComments/3.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/3.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/keepComments/3.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/3.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/keepComments/4.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/4.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/keepComments/4.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/4.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/keepComments/4.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/4.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/keepComments/4.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/4.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/lambdaIfUnit.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaIfUnit.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/lambdaIfUnit.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaIfUnit.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/lambdaIfUnit.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaIfUnit.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/lambdaIfUnit.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaIfUnit.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/multipleStatements.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/multipleStatements.kt
similarity index 71%
rename from idea/testData/intentions/convertToExpressionBody/multipleStatements.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/multipleStatements.kt
index 796fcdcdfcf..19a6cb32b07 100644
--- a/idea/testData/intentions/convertToExpressionBody/multipleStatements.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/multipleStatements.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(): String {
val v = 1
diff --git a/idea/testData/intentions/convertToExpressionBody/overridePublicFun.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/overridePublicFun.kt
similarity index 54%
rename from idea/testData/intentions/convertToExpressionBody/overridePublicFun.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/overridePublicFun.kt
index f6dae7240d6..724b38951a5 100644
--- a/idea/testData/intentions/convertToExpressionBody/overridePublicFun.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/overridePublicFun.kt
@@ -3,7 +3,7 @@ open class A {
}
class B : A() {
- public override fun foo(): String {
- return "abc"
+ public override fun foo(): String {
+ return "abc"
}
}
diff --git a/idea/testData/intentions/convertToExpressionBody/overridePublicFun.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/overridePublicFun.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/overridePublicFun.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/overridePublicFun.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/returnFromLambda.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/returnFromLambda.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/returnFromLambda.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/returnFromLambda.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/returnFromLambda2.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda2.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/returnFromLambda2.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda2.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/returnFromLambda2.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda2.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/returnFromLambda2.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda2.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/returnWithNoValue.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnWithNoValue.kt
similarity index 57%
rename from idea/testData/intentions/convertToExpressionBody/returnWithNoValue.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnWithNoValue.kt
index cfca0c58bff..6be8590b296 100644
--- a/idea/testData/intentions/convertToExpressionBody/returnWithNoValue.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnWithNoValue.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo() {
return
diff --git a/idea/testData/intentions/convertToExpressionBody/whenIfUnitExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitExhaustive.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/whenIfUnitExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitExhaustive.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/whenIfUnitExhaustive.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitExhaustive.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/whenIfUnitExhaustive.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitExhaustive.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/whenIfUnitNonExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitNonExhaustive.kt
similarity index 93%
rename from idea/testData/intentions/convertToExpressionBody/whenIfUnitNonExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitNonExhaustive.kt
index 7d522cff374..850401b79c3 100644
--- a/idea/testData/intentions/convertToExpressionBody/whenIfUnitNonExhaustive.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitNonExhaustive.kt
@@ -1,4 +1,5 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
+
enum class AccessMode { READ, WRITE, RW }
fun whenExpr(mode: Boolean, access: AccessMode) {
when (access) {
diff --git a/idea/testData/intentions/convertToExpressionBody/whenUnitExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitExhaustive.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/whenUnitExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitExhaustive.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/whenUnitExhaustive.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitExhaustive.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/whenUnitExhaustive.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitExhaustive.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/whenUnitNonExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitNonExhaustive.kt
similarity index 90%
rename from idea/testData/intentions/convertToExpressionBody/whenUnitNonExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitNonExhaustive.kt
index 25d33c8f8eb..d1f703ce9fd 100644
--- a/idea/testData/intentions/convertToExpressionBody/whenUnitNonExhaustive.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitNonExhaustive.kt
@@ -1,4 +1,5 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
+
enum class AccessMode { READ, WRITE, RW }
fun whenExpr(access: AccessMode) {
when (access) {
diff --git a/idea/testData/intentions/convertToExpressionBody/whenUnitWithElse.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitWithElse.kt
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/whenUnitWithElse.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitWithElse.kt
diff --git a/idea/testData/intentions/convertToExpressionBody/whenUnitWithElse.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitWithElse.kt.after
similarity index 100%
rename from idea/testData/intentions/convertToExpressionBody/whenUnitWithElse.kt.after
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitWithElse.kt.after
diff --git a/idea/testData/intentions/convertToExpressionBody/whenWhenNonExhaustive.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenWhenNonExhaustive.kt
similarity index 95%
rename from idea/testData/intentions/convertToExpressionBody/whenWhenNonExhaustive.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenWhenNonExhaustive.kt
index 4b7257c9300..8f3b5c7c980 100644
--- a/idea/testData/intentions/convertToExpressionBody/whenWhenNonExhaustive.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenWhenNonExhaustive.kt
@@ -1,4 +1,5 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
+
enum class AccessMode { READ, WRITE, RW }
fun whenExpr(mode: Boolean, access: AccessMode) {
when (access) {
diff --git a/idea/testData/intentions/convertToExpressionBody/while.kt b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/while.kt
similarity index 71%
rename from idea/testData/intentions/convertToExpressionBody/while.kt
rename to idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/while.kt
index 0743f794492..c5a57a49ad8 100644
--- a/idea/testData/intentions/convertToExpressionBody/while.kt
+++ b/idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/while.kt
@@ -1,4 +1,4 @@
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(p: Boolean): String {
while(true) { }
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/if.kt b/idea/testData/inspectionsLocal/useExpressionBody/if.kt
new file mode 100644
index 00000000000..9354a08aef4
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/if.kt
@@ -0,0 +1,11 @@
+// HIGHLIGHT: INFORMATION
+
+fun abs(x: Int): Int {
+ // No highlighting here
+ return if (x > 0) {
+ x
+ }
+ else {
+ -x
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/if.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/if.kt.after
new file mode 100644
index 00000000000..bb1db25e68c
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/if.kt.after
@@ -0,0 +1,9 @@
+// HIGHLIGHT: INFORMATION
+
+fun abs(x: Int): Int = // No highlighting here
+ if (x > 0) {
+ x
+ }
+ else {
+ -x
+ }
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/multiLine.kt b/idea/testData/inspectionsLocal/useExpressionBody/multiLine.kt
new file mode 100644
index 00000000000..4a4f284786e
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/multiLine.kt
@@ -0,0 +1,6 @@
+// HIGHLIGHT: INFORMATION
+
+fun Int?.orZero(): Int {
+ return this
+ ?: 0
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/multiLine.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/multiLine.kt.after
new file mode 100644
index 00000000000..75383688e2e
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/multiLine.kt.after
@@ -0,0 +1,4 @@
+// HIGHLIGHT: INFORMATION
+
+fun Int?.orZero(): Int = this
+ ?: 0
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/oneLine.kt b/idea/testData/inspectionsLocal/useExpressionBody/oneLine.kt
new file mode 100644
index 00000000000..1135a5a2048
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/oneLine.kt
@@ -0,0 +1,3 @@
+fun sqr(x: Int): Int {
+ return x * x
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/oneLine.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/oneLine.kt.after
new file mode 100644
index 00000000000..115e43d47f8
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/oneLine.kt.after
@@ -0,0 +1 @@
+fun sqr(x: Int): Int = x * x
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/when.kt b/idea/testData/inspectionsLocal/useExpressionBody/when.kt
new file mode 100644
index 00000000000..27f513a8ee5
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/when.kt
@@ -0,0 +1,7 @@
+fun sign(x: Int): Int {
+ return when {
+ x < 0 -> -1
+ x > 0 -> 1
+ else -> 0
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/when.kt.after b/idea/testData/inspectionsLocal/useExpressionBody/when.kt.after
new file mode 100644
index 00000000000..16630fc8f0c
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/when.kt.after
@@ -0,0 +1,5 @@
+fun sign(x: Int): Int = when {
+ x < 0 -> -1
+ x > 0 -> 1
+ else -> 0
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/useExpressionBody/whenWithEarlyReturn.kt b/idea/testData/inspectionsLocal/useExpressionBody/whenWithEarlyReturn.kt
new file mode 100644
index 00000000000..da6dca6e8cb
--- /dev/null
+++ b/idea/testData/inspectionsLocal/useExpressionBody/whenWithEarlyReturn.kt
@@ -0,0 +1,9 @@
+// PROBLEM: none
+
+fun sign(x: Int): Int {
+ return when {
+ x < 0 -> -1
+ x > 0 -> if (x == 42) return 42 else 1
+ else -> 0
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertToExpressionBody/.intention b/idea/testData/intentions/convertToExpressionBody/.intention
deleted file mode 100644
index da16192b1a9..00000000000
--- a/idea/testData/intentions/convertToExpressionBody/.intention
+++ /dev/null
@@ -1 +0,0 @@
-org.jetbrains.kotlin.idea.intentions.ConvertToExpressionBodyIntention
diff --git a/idea/testData/intentions/convertToExpressionBody/emptyList.kt.after b/idea/testData/intentions/convertToExpressionBody/emptyList.kt.after
deleted file mode 100644
index a903a794e84..00000000000
--- a/idea/testData/intentions/convertToExpressionBody/emptyList.kt.after
+++ /dev/null
@@ -1,3 +0,0 @@
-// WITH_RUNTIME
-
-fun foo(): List = emptyList()
\ No newline at end of file
diff --git a/idea/testData/intentions/convertToExpressionBody/funWithReturn.kt b/idea/testData/intentions/convertToExpressionBody/funWithReturn.kt
deleted file mode 100644
index db097d708c8..00000000000
--- a/idea/testData/intentions/convertToExpressionBody/funWithReturn.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-fun foo(): String {
- return "abc"
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertToExpressionBody/getWithReturn.kt b/idea/testData/intentions/convertToExpressionBody/getWithReturn.kt
deleted file mode 100644
index 15a202827fc..00000000000
--- a/idea/testData/intentions/convertToExpressionBody/getWithReturn.kt
+++ /dev/null
@@ -1,4 +0,0 @@
-val foo: String
- get() {
- return "abc"
- }
\ No newline at end of file
diff --git a/idea/testData/quickfix/addInline/local.kt b/idea/testData/quickfix/addInline/local.kt
index ae3dcf22c91..4947f867844 100644
--- a/idea/testData/quickfix/addInline/local.kt
+++ b/idea/testData/quickfix/addInline/local.kt
@@ -1,5 +1,4 @@
// "Add 'inline' to function 'foo'" "false"
-// ACTION: Convert to expression body
// ERROR: Modifier 'crossinline' is allowed only for function parameters of an inline function
fun bar() {
diff --git a/idea/testData/quickfix/addStarProjections/cast/changeFunctionalToStarProjection.kt b/idea/testData/quickfix/addStarProjections/cast/changeFunctionalToStarProjection.kt
index c10527f45dd..d175b67a088 100644
--- a/idea/testData/quickfix/addStarProjections/cast/changeFunctionalToStarProjection.kt
+++ b/idea/testData/quickfix/addStarProjections/cast/changeFunctionalToStarProjection.kt
@@ -1,5 +1,4 @@
// "class org.jetbrains.kotlin.idea.quickfix.ChangeToStarProjectionFix" "false"
-// ACTION: Convert to expression body
class Constructor(val x: T)
diff --git a/idea/testData/quickfix/addStarProjections/cast/uncheckedCastOnTypeParameter.kt b/idea/testData/quickfix/addStarProjections/cast/uncheckedCastOnTypeParameter.kt
index b3fc00c2d90..8ba08630305 100644
--- a/idea/testData/quickfix/addStarProjections/cast/uncheckedCastOnTypeParameter.kt
+++ b/idea/testData/quickfix/addStarProjections/cast/uncheckedCastOnTypeParameter.kt
@@ -1,5 +1,4 @@
// "class org.jetbrains.kotlin.idea.quickfix.ChangeToStarProjectionFix" "false"
-// ACTION: Convert to expression body
fun get(column: String, map: Map): T {
return map[column] as T
}
diff --git a/idea/testData/quickfix/autoImports/mismatchingArgs/checkArgumentTypes.test b/idea/testData/quickfix/autoImports/mismatchingArgs/checkArgumentTypes.test
index 987a89abf72..90de3554324 100644
--- a/idea/testData/quickfix/autoImports/mismatchingArgs/checkArgumentTypes.test
+++ b/idea/testData/quickfix/autoImports/mismatchingArgs/checkArgumentTypes.test
@@ -2,7 +2,6 @@
// "Import" "false"
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
// ACTION: Add parameter to function 'foo'
-// ACTION: Convert to expression body
// ACTION: Create extension function 'X.foo'
// ACTION: Create member function 'X.foo'
diff --git a/idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test b/idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test
index 0d1e45cec32..27ec8a29f8f 100644
--- a/idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test
+++ b/idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test
@@ -2,7 +2,6 @@
// "Import" "false"
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
// ACTION: Add parameter to function 'foo'
-// ACTION: Convert to expression body
// ACTION: Create extension function 'X.foo'
// ACTION: Create member function 'X.foo'
diff --git a/idea/testData/quickfix/autoImports/mismatchingArgs/notForIncompleteCall.test b/idea/testData/quickfix/autoImports/mismatchingArgs/notForIncompleteCall.test
index 369d3489600..2f36f999cbf 100644
--- a/idea/testData/quickfix/autoImports/mismatchingArgs/notForIncompleteCall.test
+++ b/idea/testData/quickfix/autoImports/mismatchingArgs/notForIncompleteCall.test
@@ -3,7 +3,6 @@
// ERROR: Type mismatch: inferred type is Int but String was expected
// ACTION: Add 'toString()' call
// ACTION: Change parameter 'p' type of function 'main.X.foo' to 'Int'
-// ACTION: Convert to expression body
// ACTION: Create function 'foo'
package main
diff --git a/idea/testData/quickfix/autoImports/mismatchingArgs/topLevelFun_notWithReceiver.test b/idea/testData/quickfix/autoImports/mismatchingArgs/topLevelFun_notWithReceiver.test
index 57db1837669..15a2e7b8f00 100644
--- a/idea/testData/quickfix/autoImports/mismatchingArgs/topLevelFun_notWithReceiver.test
+++ b/idea/testData/quickfix/autoImports/mismatchingArgs/topLevelFun_notWithReceiver.test
@@ -2,7 +2,6 @@
// "Import" "false"
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
// ACTION: Add parameter to function 'foo'
-// ACTION: Convert to expression body
// ACTION: Create extension function 'X.foo'
// ACTION: Create member function 'X.foo'
diff --git a/idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.after.kt b/idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.after.kt
index ac3ba00b8f3..05cd0f6bd93 100644
--- a/idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.after.kt
+++ b/idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.after.kt
@@ -1,6 +1,5 @@
// "Import" "false"
// ERROR: Unresolved reference: Some
-// ACTION: Convert to expression body
// ACTION: Create function 'Some'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.before.Main.kt
index ac3ba00b8f3..05cd0f6bd93 100644
--- a/idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.before.Main.kt
+++ b/idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.before.Main.kt
@@ -1,6 +1,5 @@
// "Import" "false"
// ERROR: Unresolved reference: Some
-// ACTION: Convert to expression body
// ACTION: Create function 'Some'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createClass/annotationEntry/nestedGroovyAnnotation.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/annotationEntry/nestedGroovyAnnotation.before.Main.kt
index 65accbb5ba2..f6c7b54042e 100644
--- a/idea/testData/quickfix/createFromUsage/createClass/annotationEntry/nestedGroovyAnnotation.before.Main.kt
+++ b/idea/testData/quickfix/createFromUsage/createClass/annotationEntry/nestedGroovyAnnotation.before.Main.kt
@@ -1,6 +1,5 @@
// "Create annotation 'foo'" "false"
// ERROR: Unresolved reference: foo
-// ACTION: Convert to expression body
// ACTION: Make private
// ACTION: Make internal
diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/notAbstractClass.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/notAbstractClass.kt
index 05bdc0d42dc..85d41825b89 100644
--- a/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/notAbstractClass.kt
+++ b/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/notAbstractClass.kt
@@ -1,5 +1,4 @@
// "Create abstract function 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create function 'foo'
// ACTION: Rename reference
// ERROR: Unresolved reference: foo
diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/otherExplicitReceiver.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/otherExplicitReceiver.kt
index 5d141b5a9c3..029ce3c8edf 100644
--- a/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/otherExplicitReceiver.kt
+++ b/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/otherExplicitReceiver.kt
@@ -1,5 +1,4 @@
// "Create abstract function 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create extension function 'B.foo'
// ACTION: Create member function 'B.foo'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/callInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/callInAnnotationEntry.kt
index f089d479eaf..4fda12ed3df 100644
--- a/idea/testData/quickfix/createFromUsage/createFunction/call/callInAnnotationEntry.kt
+++ b/idea/testData/quickfix/createFromUsage/createFunction/call/callInAnnotationEntry.kt
@@ -4,7 +4,6 @@
// ACTION: Make private
// ACTION: Rename reference
// ACTION: Put arguments on separate lines
-// ACTION: Convert to expression body
// ERROR: Unresolved reference: foo
// ERROR: Unresolved reference: bar
diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/extensionByExtensionReceiver/notExtensionCallable.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/extensionByExtensionReceiver/notExtensionCallable.kt
index f2f0aed292c..76e6a3d5405 100644
--- a/idea/testData/quickfix/createFromUsage/createFunction/call/extensionByExtensionReceiver/notExtensionCallable.kt
+++ b/idea/testData/quickfix/createFromUsage/createFunction/call/extensionByExtensionReceiver/notExtensionCallable.kt
@@ -1,5 +1,4 @@
// "Create extension function 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create function 'foo'
// ACTION: Rename reference
// ERROR: Unresolved reference: foo
diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/funOnGroovyType.before.Main.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/funOnGroovyType.before.Main.kt
index 6fc3b3e6682..2a1cbcdd97f 100644
--- a/idea/testData/quickfix/createFromUsage/createFunction/call/funOnGroovyType.before.Main.kt
+++ b/idea/testData/quickfix/createFromUsage/createFunction/call/funOnGroovyType.before.Main.kt
@@ -1,5 +1,4 @@
// "Create member function 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create extension function 'A.foo'
// ACTION: Rename reference
// ERROR: Unresolved reference: foo
diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/propertyOnUserType.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/propertyOnUserType.kt
index d05f216af1a..9f6d59d7e62 100644
--- a/idea/testData/quickfix/createFromUsage/createFunction/call/propertyOnUserType.kt
+++ b/idea/testData/quickfix/createFromUsage/createFunction/call/propertyOnUserType.kt
@@ -1,5 +1,4 @@
// "Create member function 'foo'" "false"
-// ACTION: Convert to expression body
// ERROR: Unresolved reference: x
class A(val n: T) {
diff --git a/idea/testData/quickfix/createFromUsage/createFunction/callableReferences/noFunctionalType.kt b/idea/testData/quickfix/createFromUsage/createFunction/callableReferences/noFunctionalType.kt
index 72b2e951ace..cb4649d8edd 100644
--- a/idea/testData/quickfix/createFromUsage/createFunction/callableReferences/noFunctionalType.kt
+++ b/idea/testData/quickfix/createFromUsage/createFunction/callableReferences/noFunctionalType.kt
@@ -1,5 +1,4 @@
// "Create function 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Rename reference
// ERROR: Unresolved reference: foo
fun bar(n: Int) = "$n"
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInClassObject.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInClassObject.kt
index cf5c520a80b..1810fa1b729 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInClassObject.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInClassObject.kt
@@ -1,5 +1,4 @@
// "Create parameter 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create property 'foo'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInObject.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInObject.kt
index 62aa2b62d05..6bc3316491c 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInObject.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInObject.kt
@@ -1,5 +1,4 @@
// "Create parameter 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create property 'foo'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInTrait.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInTrait.kt
index bc4a2a14908..cde3929fc08 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInTrait.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInTrait.kt
@@ -1,5 +1,4 @@
// "Create parameter 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create abstract property 'foo'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorNoClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorNoClass.kt
index b7257350f4c..c14d9c1fbe6 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorNoClass.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorNoClass.kt
@@ -1,5 +1,4 @@
// "Create parameter 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create property 'foo'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInClass.kt
index a8bb2e989d2..0d781d15315 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInClass.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInClass.kt
@@ -1,5 +1,4 @@
// "Create parameter 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create property 'foo'
// ACTION: Create extension property 'T.foo'
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInGenClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInGenClass.kt
index 09e72c97223..2b9ea8ced80 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInGenClass.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInGenClass.kt
@@ -1,5 +1,4 @@
// "Create parameter 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create property 'foo'
// ACTION: Create extension property 'T.foo'
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/localValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/localValNoReceiver.kt
index e90820b3086..527c7917abe 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/localValNoReceiver.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/localValNoReceiver.kt
@@ -1,5 +1,4 @@
// "Create property 'foo' as constructor parameter" "false"
-// ACTION: Convert to expression body
// ACTION: Create parameter 'foo'
// ACTION: Create local variable 'foo'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/objectMemberValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/objectMemberValNoReceiver.kt
index 49721670948..d69d34f8b15 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/objectMemberValNoReceiver.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/objectMemberValNoReceiver.kt
@@ -1,5 +1,4 @@
// "Create property 'foo' as constructor parameter" "false"
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create parameter 'foo'
// ACTION: Create property 'foo'
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/topLevelValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/topLevelValNoReceiver.kt
index 05e46c61def..cec6b603bd4 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/topLevelValNoReceiver.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/topLevelValNoReceiver.kt
@@ -1,6 +1,5 @@
// "Create property 'foo' as constructor parameter" "false"
// ACTION: Create property 'foo'
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create parameter 'foo'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnJavaType.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnJavaType.before.Main.kt
index f1771bab4a8..c143c0e31aa 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnJavaType.before.Main.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnJavaType.before.Main.kt
@@ -1,6 +1,5 @@
// "Create property 'foo' as constructor parameter" "false"
// ACTION: Create member property 'A.foo'
-// ACTION: Convert to expression body
// ACTION: Create extension property 'A.foo'
// ACTION: Rename reference
// ERROR: Unresolved reference: foo
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/abstract/notAbstractClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/abstract/notAbstractClass.kt
index d99f9bed0ca..089864bee1c 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/property/abstract/notAbstractClass.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/property/abstract/notAbstractClass.kt
@@ -1,5 +1,4 @@
// "Create abstract property 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create local variable 'foo'
// ACTION: Create parameter 'foo'
// ACTION: Create property 'foo'
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/abstract/otherExplicitReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/abstract/otherExplicitReceiver.kt
index 98c22647b71..3169cac00ec 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/property/abstract/otherExplicitReceiver.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/property/abstract/otherExplicitReceiver.kt
@@ -1,5 +1,4 @@
// "Create abstract property 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create extension property 'B.foo'
// ACTION: Create member property 'B.foo'
// ACTION: Create property 'foo' as constructor parameter
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt
index f3bb4d2c1c8..cddb7e46634 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt
@@ -1,5 +1,4 @@
// "Create property 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create parameter 'foo'
// ACTION: Create local variable 'foo'
// ACTION: Rename reference
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/memberWithTypeParameterAsReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/memberWithTypeParameterAsReceiver.kt
index 03744b178c0..e64d4b2439c 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/property/memberWithTypeParameterAsReceiver.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/property/memberWithTypeParameterAsReceiver.kt
@@ -1,7 +1,6 @@
// "Create member property 'bar'" "false"
// ACTION: Create extension property 'T.bar'
// ACTION: Rename reference
-// ACTION: Convert to expression body
// ERROR: Unresolved reference: bar
fun consume(n: Int) {}
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnGroovyType.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnGroovyType.before.Main.kt
index 973f3672dc5..16337a1fa3e 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnGroovyType.before.Main.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnGroovyType.before.Main.kt
@@ -1,5 +1,4 @@
// "Create property 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create extension property 'A.foo'
// ACTION: Rename reference
// ERROR: Unresolved reference: foo
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt
index 9d33df780c3..28e1be274db 100644
--- a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt
+++ b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt
@@ -1,5 +1,4 @@
// "Create property 'foo'" "false"
-// ACTION: Convert to expression body
// ACTION: Create extension property 'A.foo'
// ACTION: Rename reference
// ERROR: Unresolved reference: foo
diff --git a/idea/testData/quickfix/createLabel/breakNoLoop.kt b/idea/testData/quickfix/createLabel/breakNoLoop.kt
index 29e2106e016..410e5f76703 100644
--- a/idea/testData/quickfix/createLabel/breakNoLoop.kt
+++ b/idea/testData/quickfix/createLabel/breakNoLoop.kt
@@ -1,5 +1,4 @@
// "Create label foo@" "false"
-// ACTION: Convert to expression body
// ERROR: The label '@foo' does not denote a loop
// ERROR: Unresolved reference: @foo
diff --git a/idea/testData/quickfix/createLabel/continueNoLoop.kt b/idea/testData/quickfix/createLabel/continueNoLoop.kt
index df19cda0e42..8e11684aa28 100644
--- a/idea/testData/quickfix/createLabel/continueNoLoop.kt
+++ b/idea/testData/quickfix/createLabel/continueNoLoop.kt
@@ -1,5 +1,4 @@
// "Create label foo@" "false"
-// ACTION: Convert to expression body
// ERROR: The label '@foo' does not denote a loop
// ERROR: Unresolved reference: @foo
diff --git a/idea/testData/quickfix/createLabel/returnNoLambda.kt b/idea/testData/quickfix/createLabel/returnNoLambda.kt
index dd4b590bb22..942ed230d83 100644
--- a/idea/testData/quickfix/createLabel/returnNoLambda.kt
+++ b/idea/testData/quickfix/createLabel/returnNoLambda.kt
@@ -1,5 +1,4 @@
// "Create label foo@" "false"
-// ACTION: Convert to expression body
// ERROR: Unresolved reference: @foo
fun test(): Int {
diff --git a/idea/testData/quickfix/decreaseVisibility/exposedParameterType.kt b/idea/testData/quickfix/decreaseVisibility/exposedParameterType.kt
index 57333374ac1..97cc116023c 100644
--- a/idea/testData/quickfix/decreaseVisibility/exposedParameterType.kt
+++ b/idea/testData/quickfix/decreaseVisibility/exposedParameterType.kt
@@ -3,7 +3,6 @@
// ACTION: Make 'Nested' internal
// ACTION: Make 'Nested' public
// ACTION: Remove parameter 'arg'
-// ACTION: Convert to expression body
// ERROR: 'internal' function exposes its 'private' parameter type argument Nested
// ERROR: Cannot access 'Nested': it is private in 'Outer'
diff --git a/idea/testData/quickfix/moveReceiverAnnotation/notExtensionFun.kt b/idea/testData/quickfix/moveReceiverAnnotation/notExtensionFun.kt
index 70b72279c1e..c2cee5e33f8 100644
--- a/idea/testData/quickfix/moveReceiverAnnotation/notExtensionFun.kt
+++ b/idea/testData/quickfix/moveReceiverAnnotation/notExtensionFun.kt
@@ -1,6 +1,5 @@
// "Move annotation to receiver type" "false"
// ERROR: '@receiver:' annotations can only be applied to the receiver type of extension function or extension property declarations
-// ACTION: Convert to expression body
// ACTION: Make internal
// ACTION: Make private
diff --git a/idea/testData/quickfix/override/overridingOpenMethodInFinalClass.kt b/idea/testData/quickfix/override/overridingOpenMethodInFinalClass.kt
index de33d393d30..357c3dc1849 100644
--- a/idea/testData/quickfix/override/overridingOpenMethodInFinalClass.kt
+++ b/idea/testData/quickfix/override/overridingOpenMethodInFinalClass.kt
@@ -1,5 +1,4 @@
// "Make A.foo open" "false"
-// ACTION: Convert to expression body
// ERROR: This type is final, so it cannot be inherited from
class A() {
open fun foo() {}
diff --git a/idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt b/idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt
index 2d3ad536303..200ddffeb87 100644
--- a/idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt
+++ b/idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt
@@ -1,6 +1,5 @@
// "Replace with safe (?.) call" "false"
// ACTION: Add non-null asserted (!!) call
-// ACTION: Convert to expression body
// ACTION: Replace with safe (this?.) call
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A?
diff --git a/idea/testData/quickfix/typeMismatch/casts/preferExclExcl.kt b/idea/testData/quickfix/typeMismatch/casts/preferExclExcl.kt
index 58b40f6697c..1802768dc8a 100644
--- a/idea/testData/quickfix/typeMismatch/casts/preferExclExcl.kt
+++ b/idea/testData/quickfix/typeMismatch/casts/preferExclExcl.kt
@@ -2,7 +2,6 @@
// ACTION: Add 'toString()' call
// ACTION: Add non-null asserted (!!) call
// ACTION: Change parameter 's' type of function 'bar' to 'String?'
-// ACTION: Convert to expression body
// ACTION: Create function 'bar'
// ACTION: Surround with null check
// ACTION: Wrap with '?.let { ... }' call
diff --git a/idea/testData/quickfix/typeMismatch/casts/typeMismatch2.kt b/idea/testData/quickfix/typeMismatch/casts/typeMismatch2.kt
index f72b9955255..6498e862b89 100644
--- a/idea/testData/quickfix/typeMismatch/casts/typeMismatch2.kt
+++ b/idea/testData/quickfix/typeMismatch/casts/typeMismatch2.kt
@@ -1,6 +1,5 @@
// "Cast expression 'Foo()' to 'Foo'" "false"
// ACTION: Change return type of enclosing function 'foo' to 'Foo'
-// ACTION: Convert to expression body
// ERROR: Type mismatch: inferred type is Foo but Foo was expected
class Foo
diff --git a/idea/testData/quickfix/typeMismatch/letClassImplementGenericInterfaceTwice.kt b/idea/testData/quickfix/typeMismatch/letClassImplementGenericInterfaceTwice.kt
index 23567b18681..e27c8dcc638 100644
--- a/idea/testData/quickfix/typeMismatch/letClassImplementGenericInterfaceTwice.kt
+++ b/idea/testData/quickfix/typeMismatch/letClassImplementGenericInterfaceTwice.kt
@@ -1,6 +1,5 @@
// "Let 'B' implement interface 'A'" "false"
// ACTION: Change parameter 'a' type of function 'let.implement.foo' to 'B'
-// ACTION: Convert to expression body
// ACTION: Create function 'foo'
// ERROR: Type mismatch: inferred type is B but A was expected
package let.implement
diff --git a/idea/testData/quickfix/typeMismatch/letClassImplementGenericStarInterface.kt b/idea/testData/quickfix/typeMismatch/letClassImplementGenericStarInterface.kt
index 1a9777d8bf0..2bbb12525b5 100644
--- a/idea/testData/quickfix/typeMismatch/letClassImplementGenericStarInterface.kt
+++ b/idea/testData/quickfix/typeMismatch/letClassImplementGenericStarInterface.kt
@@ -1,6 +1,5 @@
// "Let 'B' implement interface 'A<*>'" "false"
// ACTION: Change parameter 'a' type of function 'let.implement.foo' to 'B'
-// ACTION: Convert to expression body
// ACTION: Create function 'foo'
// ERROR: Type mismatch: inferred type is B but A<*> was expected
diff --git a/idea/testData/quickfix/typeMismatch/letClassImplementIndirectlyInheritedInterface.kt b/idea/testData/quickfix/typeMismatch/letClassImplementIndirectlyInheritedInterface.kt
index b32d422dd96..fe45afab10e 100644
--- a/idea/testData/quickfix/typeMismatch/letClassImplementIndirectlyInheritedInterface.kt
+++ b/idea/testData/quickfix/typeMismatch/letClassImplementIndirectlyInheritedInterface.kt
@@ -1,6 +1,5 @@
// "Let 'B' implement interface 'A'" "false"
// ACTION: Change parameter 'a' type of function 'let.implement.foo' to 'B'
-// ACTION: Convert to expression body
// ACTION: Create function 'foo'
// ERROR: Type mismatch: inferred type is B but A was expected
package let.implement
diff --git a/idea/testData/quickfix/typeMismatch/letStringImplementInterface.kt b/idea/testData/quickfix/typeMismatch/letStringImplementInterface.kt
index 04dd8d6bb0f..72c77595cf7 100644
--- a/idea/testData/quickfix/typeMismatch/letStringImplementInterface.kt
+++ b/idea/testData/quickfix/typeMismatch/letStringImplementInterface.kt
@@ -1,6 +1,5 @@
// "Let 'String' implement interface 'A'" "false"
// ACTION: Change parameter 'a' type of function 'let.implement.foo' to 'String'
-// ACTION: Convert to expression body
// ACTION: To raw string literal
// ACTION: Create function 'foo'
// ERROR: Type mismatch: inferred type is String but A was expected
diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt
index 664b89226e8..e982cc5fc63 100644
--- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt
+++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt
@@ -1,6 +1,5 @@
// "Change return type of called function 'AA.f' to 'Boolean'" "false"
// ACTION: Change return type of enclosing function 'AAA.g' to 'Int'
-// ACTION: Convert to expression body
// ERROR: Type mismatch: inferred type is Int but Boolean was expected
interface A {
fun f(): Int
diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt
index cce29f5b32f..112a32a94c4 100644
--- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt
+++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt
@@ -1,6 +1,5 @@
// "Change return type of called function 'AA.contains' to 'Int'" "false"
// ACTION: Change return type of enclosing function 'AAA.g' to 'Boolean'
-// ACTION: Convert to expression body
// ACTION: Replace overloaded operator with function call
// ERROR: Type mismatch: inferred type is Boolean but Int was expected
interface A {
diff --git a/idea/testData/quickfix/unusedSuppressAnnotation/notForDeprecated.kt b/idea/testData/quickfix/unusedSuppressAnnotation/notForDeprecated.kt
index 5edf575796d..214e2556cd7 100644
--- a/idea/testData/quickfix/unusedSuppressAnnotation/notForDeprecated.kt
+++ b/idea/testData/quickfix/unusedSuppressAnnotation/notForDeprecated.kt
@@ -1,5 +1,4 @@
// "Suppress for declarations annotated by 'kotlin.Deprecated'" "false"
// ACTION: Create test
-// ACTION: Convert to expression body
@Deprecated("")
fun foo(){}
diff --git a/idea/testData/quickfix/unusedSuppressAnnotation/notForJetBrains.kt b/idea/testData/quickfix/unusedSuppressAnnotation/notForJetBrains.kt
index 1c9efa73133..dfcca8efce2 100644
--- a/idea/testData/quickfix/unusedSuppressAnnotation/notForJetBrains.kt
+++ b/idea/testData/quickfix/unusedSuppressAnnotation/notForJetBrains.kt
@@ -1,7 +1,6 @@
// "Suppress for declarations annotated by 'org.jetbrains.annotations.NonNls'" "false"
// ACTION: Safe delete 'foo'
// ACTION: Create test
-// ACTION: Convert to expression body
import org.jetbrains.annotations.NonNls
@NonNls
diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt
index 772243a75ec..6f3e9b2775d 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt
+++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt
@@ -32,26 +32,34 @@ import org.jetbrains.kotlin.idea.test.DirectiveBasedActionUtils
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
import org.jetbrains.kotlin.psi.KtFile
+import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.junit.Assert
import java.io.File
abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCase() {
- protected open fun inspectionFileName(): String = ".inspection"
+ private val inspectionFileName: String
+ get() = ".inspection"
- protected open fun afterFileNameSuffix(): String = ".after"
+ private val afterFileNameSuffix: String
+ get() = ".after"
- protected open fun expectedProblemDirectiveName(): String = "PROBLEM"
+ private val expectedProblemDirectiveName: String
+ get() = "PROBLEM"
- protected open fun fixTextDirectiveName(): String = "FIX"
+ private val expectedProblemHighlightType: String
+ get() = "HIGHLIGHT"
+
+ private val fixTextDirectiveName: String
+ get() = "FIX"
private fun createInspection(testDataFile: File): AbstractKotlinInspection {
val candidateFiles = Lists.newArrayList()
var current: File? = testDataFile.parentFile
while (current != null) {
- val candidate = File(current, inspectionFileName())
+ val candidate = File(current, inspectionFileName)
if (candidate.exists()) {
candidateFiles.add(candidate)
}
@@ -110,13 +118,18 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa
private fun doTestFor(mainFilePath: String, file: VirtualFile, inspection: AbstractKotlinInspection, fileText: String) {
val problemExpectedString = InTextDirectivesUtils.findStringWithPrefixes(
- fileText, "// ${expectedProblemDirectiveName()}: ")
+ fileText, "// $expectedProblemDirectiveName: ")
val problemExpected = problemExpectedString == null || problemExpectedString != "none"
+ val highlightExpectedString = InTextDirectivesUtils.findStringWithPrefixes(
+ fileText, "// $expectedProblemHighlightType: ")
val presentation = runInspection(inspection, project, listOf(file))
val problemDescriptors = presentation.problemDescriptors
.filterIsInstance()
- .filter { myFixture.caretOffset in it.psiElement.textRange }
+ .filter {
+ val caretOffset = myFixture.caretOffset
+ caretOffset in it.textRangeInElement?.shiftRight(it.psiElement.startOffset) ?: it.psiElement.textRange
+ }
Assert.assertTrue(
if (!problemExpected)
"No problems should be detected at caret\n" +
@@ -130,8 +143,13 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa
"Active problems: ${problemDescriptors.joinToString { it.descriptionTemplate }}",
problemDescriptors.any { it.descriptionTemplate == problemExpectedString })
}
+ if (highlightExpectedString != null) {
+ Assert.assertTrue("Expected the following problem highlight type\n" +
+ "Actual types: ${problemDescriptors.joinToString { it.highlightType.toString() } }",
+ problemDescriptors.all { it.highlightType.toString() == highlightExpectedString })
+ }
- val localFixTextString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// " + fixTextDirectiveName() + ": ")
+ val localFixTextString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// $fixTextDirectiveName: ")
val localFixActions = problemDescriptors.flatMap {
problem ->
val fixes = problem.fixes
@@ -155,7 +173,7 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa
project.executeWriteCommand(localFixAction!!.name, null) {
localFixAction.applyFix(project, problemDescriptor)
}
- val canonicalPathToExpectedFile = mainFilePath + afterFileNameSuffix()
+ val canonicalPathToExpectedFile = mainFilePath + afterFileNameSuffix
try {
myFixture.checkResultByFile(canonicalPathToExpectedFile)
}
diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
index 052721aab38..4521ce8b95f 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
@@ -837,6 +837,327 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
}
}
+ @TestMetadata("idea/testData/inspectionsLocal/useExpressionBody")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class UseExpressionBody extends AbstractLocalInspectionTest {
+ public void testAllFilesPresentInUseExpressionBody() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/useExpressionBody"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("if.kt")
+ public void testIf() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/if.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("multiLine.kt")
+ public void testMultiLine() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/multiLine.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("oneLine.kt")
+ public void testOneLine() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/oneLine.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("when.kt")
+ public void testWhen() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/when.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("whenWithEarlyReturn.kt")
+ public void testWhenWithEarlyReturn() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/whenWithEarlyReturn.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class ConvertToExpressionBody extends AbstractLocalInspectionTest {
+ public void testAllFilesPresentInConvertToExpressionBody() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("anonymousObjectExpression.kt")
+ public void testAnonymousObjectExpression() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/anonymousObjectExpression.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("assignPlus.kt")
+ public void testAssignPlus() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/assignPlus.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("assignment.kt")
+ public void testAssignment() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/assignment.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("constructorWithEmptyBody.kt")
+ public void testConstructorWithEmptyBody() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/constructorWithEmptyBody.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("declaration.kt")
+ public void testDeclaration() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/declaration.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("elvisIfElseUnit.kt")
+ public void testElvisIfElseUnit() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfElseUnit.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("elvisIfUnit.kt")
+ public void testElvisIfUnit() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisIfUnit.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("elvisWhenUnitNonExhaustive.kt")
+ public void testElvisWhenUnitNonExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/elvisWhenUnitNonExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("emptyList.kt")
+ public void testEmptyList() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/emptyList.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("expressionWithReturns1.kt")
+ public void testExpressionWithReturns1() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/expressionWithReturns1.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("expressionWithReturns2.kt")
+ public void testExpressionWithReturns2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/expressionWithReturns2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithEmptyBody.kt")
+ public void testFunWithEmptyBody() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithEmptyBody2.kt")
+ public void testFunWithEmptyBody2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithEmptyBody2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithImplicitUnitTypeWithThrow.kt")
+ public void testFunWithImplicitUnitTypeWithThrow() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithNoBlock.kt")
+ public void testFunWithNoBlock() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNoBlock.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithNothingType.kt")
+ public void testFunWithNothingType() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithNothingType.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithReturn.kt")
+ public void testFunWithReturn() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithReturn.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithUnitType.kt")
+ public void testFunWithUnitType() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithUnitType2.kt")
+ public void testFunWithUnitType2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitType2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("funWithUnitTypeWithThrow.kt")
+ public void testFunWithUnitTypeWithThrow() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/funWithUnitTypeWithThrow.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("functionLiteral.kt")
+ public void testFunctionLiteral() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/functionLiteral.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("getWithReturn.kt")
+ public void testGetWithReturn() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/getWithReturn.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ifElseUnit.kt")
+ public void testIfElseUnit() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifElseUnit.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ifUnit.kt")
+ public void testIfUnit() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifUnit.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ifWhenUnitExhaustive.kt")
+ public void testIfWhenUnitExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ifWhenUnitNonExhaustive.kt")
+ public void testIfWhenUnitNonExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/ifWhenUnitNonExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lambdaIfUnit.kt")
+ public void testLambdaIfUnit() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaIfUnit.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lambdaWhenUnitNonExhaustive.kt")
+ public void testLambdaWhenUnitNonExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("multipleStatements.kt")
+ public void testMultipleStatements() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/multipleStatements.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("overridePublicFun.kt")
+ public void testOverridePublicFun() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/overridePublicFun.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("returnFromLambda.kt")
+ public void testReturnFromLambda() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("returnFromLambda2.kt")
+ public void testReturnFromLambda2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnFromLambda2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("returnWithNoValue.kt")
+ public void testReturnWithNoValue() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/returnWithNoValue.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("whenIfUnitExhaustive.kt")
+ public void testWhenIfUnitExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("whenIfUnitNonExhaustive.kt")
+ public void testWhenIfUnitNonExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenIfUnitNonExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("whenUnitExhaustive.kt")
+ public void testWhenUnitExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("whenUnitNonExhaustive.kt")
+ public void testWhenUnitNonExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitNonExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("whenUnitWithElse.kt")
+ public void testWhenUnitWithElse() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenUnitWithElse.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("whenWhenNonExhaustive.kt")
+ public void testWhenWhenNonExhaustive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/whenWhenNonExhaustive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("while.kt")
+ public void testWhile() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/while.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class KeepComments extends AbstractLocalInspectionTest {
+ @TestMetadata("1.kt")
+ public void test1() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/1.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("2.kt")
+ public void test2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("3.kt")
+ public void test3() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/3.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("4.kt")
+ public void test4() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments/4.kt");
+ doTest(fileName);
+ }
+
+ public void testAllFilesPresentInKeepComments() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/useExpressionBody/convertToExpressionBody/keepComments"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
+ }
+ }
+ }
+ }
+
@TestMetadata("idea/testData/inspectionsLocal/wrapUnaryOperator")
@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 c3ca978becd..65858dd9ec0 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
@@ -6501,288 +6501,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
}
}
- @TestMetadata("idea/testData/intentions/convertToExpressionBody")
- @TestDataPath("$PROJECT_ROOT")
- @RunWith(JUnit3RunnerWithInners.class)
- public static class ConvertToExpressionBody extends AbstractIntentionTest {
- public void testAllFilesPresentInConvertToExpressionBody() throws Exception {
- KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToExpressionBody"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
- }
-
- @TestMetadata("anonymousObjectExpression.kt")
- public void testAnonymousObjectExpression() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/anonymousObjectExpression.kt");
- doTest(fileName);
- }
-
- @TestMetadata("assignPlus.kt")
- public void testAssignPlus() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/assignPlus.kt");
- doTest(fileName);
- }
-
- @TestMetadata("assignment.kt")
- public void testAssignment() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/assignment.kt");
- doTest(fileName);
- }
-
- @TestMetadata("constructorWithEmptyBody.kt")
- public void testConstructorWithEmptyBody() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/constructorWithEmptyBody.kt");
- doTest(fileName);
- }
-
- @TestMetadata("declaration.kt")
- public void testDeclaration() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/declaration.kt");
- doTest(fileName);
- }
-
- @TestMetadata("elvisIfElseUnit.kt")
- public void testElvisIfElseUnit() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/elvisIfElseUnit.kt");
- doTest(fileName);
- }
-
- @TestMetadata("elvisIfUnit.kt")
- public void testElvisIfUnit() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/elvisIfUnit.kt");
- doTest(fileName);
- }
-
- @TestMetadata("elvisWhenUnitNonExhaustive.kt")
- public void testElvisWhenUnitNonExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/elvisWhenUnitNonExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("emptyList.kt")
- public void testEmptyList() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/emptyList.kt");
- doTest(fileName);
- }
-
- @TestMetadata("expressionWithReturns1.kt")
- public void testExpressionWithReturns1() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/expressionWithReturns1.kt");
- doTest(fileName);
- }
-
- @TestMetadata("expressionWithReturns2.kt")
- public void testExpressionWithReturns2() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/expressionWithReturns2.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithEmptyBody.kt")
- public void testFunWithEmptyBody() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithEmptyBody.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithEmptyBody2.kt")
- public void testFunWithEmptyBody2() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithEmptyBody2.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithImplicitUnitTypeWithThrow.kt")
- public void testFunWithImplicitUnitTypeWithThrow() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithImplicitUnitTypeWithThrow.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithNoBlock.kt")
- public void testFunWithNoBlock() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithNoBlock.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithNothingType.kt")
- public void testFunWithNothingType() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithNothingType.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithReturn.kt")
- public void testFunWithReturn() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithReturn.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithUnitType.kt")
- public void testFunWithUnitType() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithUnitType.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithUnitType2.kt")
- public void testFunWithUnitType2() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithUnitType2.kt");
- doTest(fileName);
- }
-
- @TestMetadata("funWithUnitTypeWithThrow.kt")
- public void testFunWithUnitTypeWithThrow() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/funWithUnitTypeWithThrow.kt");
- doTest(fileName);
- }
-
- @TestMetadata("functionLiteral.kt")
- public void testFunctionLiteral() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/functionLiteral.kt");
- doTest(fileName);
- }
-
- @TestMetadata("getWithReturn.kt")
- public void testGetWithReturn() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/getWithReturn.kt");
- doTest(fileName);
- }
-
- @TestMetadata("ifElseUnit.kt")
- public void testIfElseUnit() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/ifElseUnit.kt");
- doTest(fileName);
- }
-
- @TestMetadata("ifUnit.kt")
- public void testIfUnit() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/ifUnit.kt");
- doTest(fileName);
- }
-
- @TestMetadata("ifWhenUnitExhaustive.kt")
- public void testIfWhenUnitExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/ifWhenUnitExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("ifWhenUnitNonExhaustive.kt")
- public void testIfWhenUnitNonExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/ifWhenUnitNonExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("lambdaIfUnit.kt")
- public void testLambdaIfUnit() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/lambdaIfUnit.kt");
- doTest(fileName);
- }
-
- @TestMetadata("lambdaWhenUnitNonExhaustive.kt")
- public void testLambdaWhenUnitNonExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/lambdaWhenUnitNonExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("multipleStatements.kt")
- public void testMultipleStatements() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/multipleStatements.kt");
- doTest(fileName);
- }
-
- @TestMetadata("overridePublicFun.kt")
- public void testOverridePublicFun() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/overridePublicFun.kt");
- doTest(fileName);
- }
-
- @TestMetadata("returnFromLambda.kt")
- public void testReturnFromLambda() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/returnFromLambda.kt");
- doTest(fileName);
- }
-
- @TestMetadata("returnFromLambda2.kt")
- public void testReturnFromLambda2() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/returnFromLambda2.kt");
- doTest(fileName);
- }
-
- @TestMetadata("returnWithNoValue.kt")
- public void testReturnWithNoValue() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/returnWithNoValue.kt");
- doTest(fileName);
- }
-
- @TestMetadata("whenIfUnitExhaustive.kt")
- public void testWhenIfUnitExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/whenIfUnitExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("whenIfUnitNonExhaustive.kt")
- public void testWhenIfUnitNonExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/whenIfUnitNonExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("whenUnitExhaustive.kt")
- public void testWhenUnitExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/whenUnitExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("whenUnitNonExhaustive.kt")
- public void testWhenUnitNonExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/whenUnitNonExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("whenUnitWithElse.kt")
- public void testWhenUnitWithElse() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/whenUnitWithElse.kt");
- doTest(fileName);
- }
-
- @TestMetadata("whenWhenNonExhaustive.kt")
- public void testWhenWhenNonExhaustive() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/whenWhenNonExhaustive.kt");
- doTest(fileName);
- }
-
- @TestMetadata("while.kt")
- public void testWhile() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/while.kt");
- doTest(fileName);
- }
-
- @TestMetadata("idea/testData/intentions/convertToExpressionBody/keepComments")
- @TestDataPath("$PROJECT_ROOT")
- @RunWith(JUnit3RunnerWithInners.class)
- public static class KeepComments extends AbstractIntentionTest {
- @TestMetadata("1.kt")
- public void test1() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/keepComments/1.kt");
- doTest(fileName);
- }
-
- @TestMetadata("2.kt")
- public void test2() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/keepComments/2.kt");
- doTest(fileName);
- }
-
- @TestMetadata("3.kt")
- public void test3() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/keepComments/3.kt");
- doTest(fileName);
- }
-
- @TestMetadata("4.kt")
- public void test4() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToExpressionBody/keepComments/4.kt");
- doTest(fileName);
- }
-
- public void testAllFilesPresentInKeepComments() throws Exception {
- KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToExpressionBody/keepComments"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
- }
- }
- }
-
@TestMetadata("idea/testData/intentions/convertToForEachFunctionCall")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)