Commit 557a9ea4 authored by Andrei Klunnyi's avatar Andrei Klunnyi Committed by intellij-monorepo-bot
Browse files

KTIJ-19939 Provide quickfix for deprecated confusing expressions in when branches

^KTIJ-19939 fixed

(cherry picked from commit ba5c306d72b06846c72517f74b8f0aeebf512bf1)

GitOrigin-RevId: 65c1c5224f557f39b32d535619eaac6edc783ed3
parent 7b1b9271
Showing with 179 additions and 42 deletions
+179 -42
......@@ -44,8 +44,8 @@ fix.change.to.labeled.return.text=Change to ''{0}''
fix.change.suspend.hierarchy.add=Add 'suspend' modifier to all functions in hierarchy
fix.change.suspend.hierarchy.remove=Remove 'suspend' modifier from all functions in hierarchy
fix.change.progress.looking.inheritors=Looking for class {0} inheritors
fix.change.progress.analyzing.class.hierarchy=Analyzing class hierarchy
fix.change.progress.looking.inheritors=Looking for class {0} inheritors\u2026
fix.change.progress.analyzing.class.hierarchy=Analyzing class hierarchy\u2026
fix.change.return.type.family=Change type
fix.change.return.type.text.primary.constructor=Change parameter ''{0}'' type of primary constructor of class ''{1}'' to ''{2}''
......@@ -107,7 +107,7 @@ fix.add.suspend.modifier.receiver.generic=Make receiver type suspend
fix.add.property.to.supertype.family=Add property to supertype
fix.add.property.to.supertype.text=Add ''{0}'' to ''{1}''
fix.add.property.to.supertype.text.generic=Add property to supertype
fix.add.property.to.supertype.text.generic=Add property to supertype\u2026
fix.add.property.to.supertype.progress=Add property to type
fix.add.property.to.supertype.choose.type=Choose Type
......@@ -121,7 +121,7 @@ fix.add.function.parameters.add.parameter.generic.function=Add {0,choice,1#param
fix.change.signature.family=Change signature of function/constructor
fix.change.signature.function.family=Change function signature
fix.change.signature.function.text=Change function signature to ''{0}''
fix.change.signature.function.text.generic=Change function signature
fix.change.signature.function.text.generic=Change function signature\u2026
fix.change.signature.function.popup.title=Choose Signature
fix.change.signature.lambda=Change the signature of lambda expression
fix.change.signature.lambda.command=Change The Signature Of Lambda Expression
......@@ -134,7 +134,7 @@ fix.change.signature.unnamed.parameter=parameter
fix.change.object.to.class=Change 'object' to 'class'
fix.add.function.supertype.family=Add function to supertype
fix.add.function.supertype.text=Add function to supertype
fix.add.function.supertype.text=Add function to supertype\u2026
fix.add.function.supertype.progress=Add Function to Type
fix.add.function.supertype.choose.type=Choose Type
fix.add.function.supertype.add.to=Add ''{0}'' to ''{1}''
......@@ -165,7 +165,7 @@ fix.potentially.broken.inheritance.title=Potentially Broken Inheritance
fix.potentially.broken.inheritance.message=This change could potentially break the inheritors.\nDo you want to continue?
fix.add.argument.name.family=Add name to argument
fix.add.argument.name.text.generic=Add name to argument
fix.add.argument.name.text.generic=Add name to argument\u2026
fix.add.argument.name.text=Add name to argument: ''{0}''
fix.add.argument.name.step.choose.parameter.title=Choose Parameter Name
......@@ -380,7 +380,7 @@ action.new.worksheet.name=Kotlin Worksheet
action.new.worksheet.description=Creates new Kotlin Worksheet
action.new.worksheet.dialog.title=New Kotlin Worksheet
breadcrumbs.tooltip.indexing=Indexing
breadcrumbs.tooltip.indexing=Indexing\u2026
copy.paste.resolve.references=Resolve pasted references
......@@ -460,12 +460,12 @@ hints.settings.lambda.return=Return expressions
hints.settings.lambda.receivers.parameters=Implicit receivers and parameters
hints.settings.ranges=Ranges
hints.ranges.rangeTo.left=
hints.ranges.rangeTo.right=
hints.ranges.until.left=
hints.ranges.rangeTo.left=\u2264
hints.ranges.rangeTo.right=\u2264
hints.ranges.until.left=\u2264
hints.ranges.until.right=<
hints.ranges.downTo.left=
hints.ranges.downTo.right=
hints.ranges.downTo.left=\u2265
hints.ranges.downTo.right=\u2265
hints.settings.suspending=Suspending calls
......@@ -480,11 +480,11 @@ presentation.text.object.in.container=object in {0}
project.view.class.initializer=class initializer
project.view.class.error.name=no name provided
copy.text.adding.imports=Adding imports
copy.text.adding.imports=Adding imports\u2026
copy.text.clipboard.content.seems.to.be.java.code.do.you.want.to.convert.it.to.kotlin=Clipboard content seems to be Java code. Do you want to convert it to Kotlin?
copy.text.convert.java.to.kotlin.title=Convert Java to Kotlin
copy.text.copied.kotlin.code=Copied kotlin code
copy.text.resolving.references=Resolving references
copy.text.resolving.references=Resolving references\u2026
copy.title.convert.code.from.java=Convert Code From Java
editor.checkbox.title.auto.add.val.keyword.to.data.inline.class.constructor.parameters=Auto add val keyword to data/inline class constructor parameters
......@@ -507,7 +507,7 @@ facet.text.following.arguments.override.facet.settings=Following arguments overr
facet.text.following.options.are.not.correct=Following options are not correct:
facet.text.multiplatform=Multiplatform
find.usages.progress.text.declaration.superMethods=Resolving super methods
find.usages.progress.text.declaration.superMethods=Resolving super methods\u2026
formatter.button.text.use.import.with.when.at.least=Use import with '*' when at least
formatter.button.text.use.import.with=Use import with '*'
......@@ -645,7 +645,7 @@ import.optimizer.progress.indicator.text.collect.imports.for=Collect imports for
import.optimizer.text.import={0, choice, 0#import|2#imports}
import.optimizer.text.non.zero=Removed {0} {1}{2, choice, 0#|1#, added {2} {3}}
import.optimizer.text.zero=Rearranged imports
import.progress.text.resolve.imports=Find All Imports
import.progress.text.resolve.imports=Find All Imports\u2026
version.message.is.deprecated.since.1.2.0.and.should.be.replaced.with={0} is deprecated since 1.2.0 and should be replaced with {1}
......@@ -713,7 +713,7 @@ configuration.name.kotlin.compiler=Kotlin Compiler
configuration.name.kotlin=Kotlin
configuration.name.method=Method
configuration.status.text.installation.failed=Installation failed
configuration.status.text.installing=Installing
configuration.status.text.installing=Installing\u2026
configuration.title.add.exclusion=Add Exclusion
configuration.text.and=and
configuration.text.other.s=other(s)
......@@ -736,7 +736,7 @@ configuration.apply.new.code.style=Apply the code style
configuration.is.resolve.module.per.source.set=Legacy Gradle Importing Mode Detected
configuration.update.is.resolve.module.per.source.set=The IDE is currently configured to create a single module per Gradle project. This mode is incompatible with Kotlin Multiplatform projects, that requires single module per Gradle source set.
configuration.apply.is.resolve.module.per.source.set=Fix and re-import project
configuration.do.not.suggest.update.is.resolve.module.per.source.set=Dont show again
configuration.do.not.suggest.update.is.resolve.module.per.source.set=Don\u2019t show again
#Refactoring
......@@ -955,7 +955,7 @@ text.move.method.is.not.supported.for.non.project.methods=Move method is not sup
text.move.method.is.not.supported.for.generic.classes=Move method is not supported for generic classes
text.move.method.is.not.supported.when.method.is.a.part.of.inheritance.hierarchy=Move method is not supported when method is a part of inheritance hierarchy
text.references.to.outer.classes.have.to.be.added.manually=References to outer classes will have to be added manually after move
action.move.method=Move Method
action.move.method=Move Method\u2026
text.move.file.0=Move {0}
text.move.refactoring.not.available.during.indexing=Move refactoring is not available while indexing is in progress
text.moving.multiple.nested.classes.to.top.level.not.supported=Moving multiple nested classes to top-level is not supported
......@@ -1022,7 +1022,7 @@ text.type.parameters=Type &Parameters
text.type=Type
text.unexpected.element.type.0=Unexpected element type: {0}
text.update.usages.to.reflect.declaration.0.move=Update usages to reflect {0, choice, 0#declaration|1#declarations} move
text.updating.usages.progress=Updating usages
text.updating.usages.progress=Updating usages\u2026
text.cannot.inline.reference.from.0.to.1=Cannot inline reference from {0} to {1}
title.inline.function=Inline Function
title.inline.property=Inline Property
......@@ -1069,7 +1069,7 @@ create.0=Create {0}
create.package.0=Create package ''{0}''
text.type.parameter=type {0, choice, 0#parameter|2#parameters}
create.0.in.1=Create {0} in {1}
searching.0=Searching {0}
searching.0=Searching {0}\u2026
create.property.0.as.constructor.parameter=Create property ''{0}'' as constructor parameter
create.parameter.0=Create parameter ''{0}''
add.property=Add property
......@@ -1255,7 +1255,7 @@ change.to.correct.long.suffix.l=Change to correct long suffix 'L'
change.to.correct.primitive.type=Change to correct primitive type
0.from.1={0} from {1}
checking.data.classes=Checking data classes
checking.data.class.0.of.1=Checking data class {0} of {1}
checking.data.class.0.of.1=Checking data class {0} of {1}\u2026
difference.found.for.data.class.0.found.1.2=Difference found for data class {0}. Found {1} usage(s) but {2} expected
title.error=Error
analyzed.0.classes.no.difference.found=Analyzed {0} classes. No difference found.
......@@ -1651,7 +1651,7 @@ add.braces.to.when.all.entries=Add braces to all 'when' entries
add.jvmoverloads.annotation.to.0=Add ''@JvmOverloads'' annotation to {0}
text.primary.constructor=primary constructor
function.0=function ''{0}''
looking.for.usages.in.java.files=Looking for usages in Java files
looking.for.usages.in.java.files=Looking for usages in Java files\u2026
add.return.at.0=Add ''return@{0}''
add.0.to.argument=Add ''{0} ='' to argument
add.val.var.to.parameter.0=Add ''val''/''var'' to parameter ''{0}''
......@@ -1667,7 +1667,7 @@ can.t.modify.0=Can''t modify {0}
0.already.exists={0} already exists
type.arguments.will.be.lost.after.conversion.0=Type arguments will be lost after conversion: {0}
call.with.arguments.will.be.skipped.0=Call with arguments will be skipped: {0}
looking.for.usages.and.conflicts=Looking for usages and conflicts
looking.for.usages.and.conflicts=Looking for usages and conflicts\u2026
following.expression.won.t.be.processed.since.refactoring.can.t.preserve.its.semantics.0=Following expression won''t be processed since refactoring can''t preserve its semantics: {0}
callable.reference.transformation.is.not.supported.0=Callable reference transformation is not supported: {0}
can.t.replace.non.kotlin.reference.with.call.expression.0=Can''t replace non-Kotlin reference with call expression: {0}
......@@ -1747,7 +1747,7 @@ convert.reference.to.lambda=Convert reference to lambda
following.problems.are.found=Following problems are found:\n
all.expected.and.actual.classes.must.be.sealed.classes=All expected and actual classes must be sealed classes.\n
all.inheritors.must.be.nested.objects.of.the.class.itself.and.may.not.inherit.from.other.classes.or.interfaces=All inheritors must be nested objects of the class itself and may not inherit from other classes or interfaces.\n
searching.inheritors=Searching inheritors
searching.inheritors=Searching inheritors\u2026
convert.to.enum.class=Convert to enum class
convert.to.primary.constructor=Convert to primary constructor
convert.to.primary.constructor.before.text=Secondary constructor should be converted to a primary one
......@@ -1804,7 +1804,7 @@ companion.object.already.contains.0=Companion object already contains {0}
0.is.overridden.by.declaration.s.in.a.subclass={0} is overridden by declaration(s) in a subclass
move.to.companion.object=Move to companion object
move.to.companion.object.command=Move To Companion Object
moving.to.companion.object=Moving to companion object
moving.to.companion.object=Moving to companion object\u2026
move.to.top.level=Move to top level
package.0.already.contains.1=Package ''{0}'' already contains {1}
move.to.class.body=Move to class body
......@@ -1888,11 +1888,11 @@ text.done=Done
file.lines=File lines
max.functions.to.visit=Max functions to visit
move.refactoring.testing=Move refactoring testing
compiling.project=Compiling project
saving.files=Saving files
perform.refactoring=Perform refactoring
update.indices=Update indices
reset.files=Reset files
compiling.project=Compiling project\u2026
saving.files=Saving files\u2026
perform.refactoring=Perform refactoring\u2026
update.indices=Update indices\u2026
reset.files=Reset files\u2026
cannot.get.or.create.results.file=Cannot get or create results file
cannot.get.project.root.directory=Cannot get project root directory
0.try.1.with.2.fails.and.3.verifications={0} [Try {1} with {2} fails and {3} verifications]
......@@ -2034,9 +2034,9 @@ action.KotlinGenerateSetUpMethod.text=SetUp Function
action.KotlinGenerateTestMethod.text=Test Function
action.KotlinShellExecute.text=Execute Kotlin Code
action.KotlinShellExecute.description=Execute Kotlin code in console
action.IntroduceTypeAlias.text=Type _Alias
action.IntroduceTypeParameter.text=T_ype Parameter
action.ExtractFunctionToScope.text=Function to _Scope
action.IntroduceTypeAlias.text=Type _Alias\u2026
action.IntroduceTypeParameter.text=T_ype Parameter\u2026
action.ExtractFunctionToScope.text=Function to _Scope\u2026
action.KotlinThrowException.text=Drop an Error from Kotlin Plugin
action.KotlinFormattingSettingsStatusAction.text=Formatter Settings Info
action.CopyAsDiagnosticTest.text=Copy Current File As Diagnostic Test
......@@ -2054,8 +2054,8 @@ action.TestMoveRefactiringAction.text=Test Move Refactoring on Opened Project
group.KotlinRefactoringTesting.text=Kotlin Refactoring Testing
action.DumbModeTremble.text=Tremble Dumb Mode
group.InternalKotlin.text=Kotlin Internal Actions
action.IntroduceProperty.text=P_roperty
action.ExtractFunction.text=_Function
action.IntroduceProperty.text=P_roperty\u2026
action.ExtractFunction.text=_Function\u2026
action.KotlinCodeMigrationToggle.text=Enable Migrations Detection (Experimental)
action.KotlinCodeMigration.text=Run Code Migrations
action.CopyKotlinProjectInformation.text=Copy Kotlin Project Overview To Clipboard
......@@ -2124,6 +2124,7 @@ inspection.do.not.propagate.method.deprecation.through.overrides=Do not propagat
inspection.non.exhaustive.when.statement.migration.display.name=Non-exhaustive 'when' statements will be prohibited since 1.7
inspection.prohibit.use.site.target.annotations.on.super.types.migration.display.name=Meaningless annotations targets on superclass
inspection.redundant.label.migration.display.name=Redundant label
inspection.ambiguous.expression.when.branch.migration.display.name=Ambiguous logical expressions in 'when' branches since 1.7
inspection.add.conversion.call.display.name=Explicit conversion from `Int` needed since 1.9
inspection.deprecated.inline.classes.migration.display.name=Inline classes are deprecated since 1.5
inspection.deprecated.inline.class.text=Deprecated inline class
......@@ -2315,7 +2316,7 @@ fix.remove.argument.text=Remove argument
fix.remove.redundant.star.text=Remove redundant *
refactoring.extract.to.separate.file.text=Extract to separate file
action.usage.update.command=Usage Update
progress.title.analyze.extraction.data=Analyze extraction data
progress.title.analyze.extraction.data=Analyze extraction data\u2026
fix.move.file.to.package.dir.name.text=source root
move.refactoring.error.text.cannot.perform.refactoring.since.the.following.files.already.exist=Cannot perform refactoring since the following files already exist:\n\n
kotlin.script.definitions.title=Manage Script Definitions
......@@ -2324,7 +2325,7 @@ kotlin.script.definitions.model.name.autoReloadScriptDependencies=Auto Reload
kotlin.script.definitions.model.name.is.enabled=Is Enabled
kotlin.script.definitions.model.name.pattern.extension=Pattern/Extension
kotlin.script.definitions.model.name.name=Name
kotlin.script.lookup.definitions=Looking up Kotlin script definitions
kotlin.script.lookup.definitions=Looking up Kotlin script definitions\u2026
codestyle.name.kotlin=Kotlin
add.missing.class.keyword=Add missing 'class' keyword
fix.move.typealias.to.top.level=Move typealias to top level
......@@ -2368,7 +2369,7 @@ hints.codevision.inheritors.format={0, choice, 1#1 Inheritor|2#{0,number} Inheri
hints.codevision.inheritors.to_many.format={0,number}+ Inheritors
hints.codevision.overrides.format={0, choice, 1#1 Override|2#{0,number} Overrides}
hints.codevision.overrides.to_many.format={0,number}+ Overrides
hints.codevision.settings=Settings
hints.codevision.settings=Settings\u2026
convert.string.template.to.build.string=Convert to 'buildString' call
convert.concatenation.to.build.string=Convert concatenation to 'buildString' call
convert.to.indexed.function.call=Convert to indexed function call
......@@ -2454,7 +2455,7 @@ kotlin.language.configurable=Kotlin
kotlin.scripting.configurable=Kotlin Scripting
hint.text.no.expression.found=No expression found
dialog.title.getting.expression.type=Getting Expression Type
progress.title.calculating.type=Calculating type
progress.title.calculating.type=Calculating type\u2026
intention.name.correct.parameter.name=Correct parameter name
intention.add.import.alias.group.name=Add Import Alias
inspection.message.inconsistent.parameter.name.for.0=Inconsistent parameter name for ''{0}''
......@@ -2543,7 +2544,7 @@ change.to.var=Change to 'var'
remove.redundant.0.modifier=Remove redundant ''{0}'' modifier
searching.for.implicit.usages=Searching for implicit usages
searching.for.implicit.usages=Searching for implicit usages\u2026
usage.provider.text.property.of.0={0} of {1}
usage.provider.text.unnamed=<unnamed>
......@@ -2551,4 +2552,6 @@ inspection.unnecessary.opt_in.annotation.display.name=Unnecessary '@OptIn' annot
inspection.unnecessary.opt_in.redundant.marker=The opt-in marker is redundant: no experimental API marked with ''{0}'' is used
inspection.unnecessary.opt_in.redundant.annotation=The opt-in annotation is redundant: no matching experimental API is used
inspection.unnecessary.opt_in.remove.marker.fix.family.name=Remove opt-in marker
inspection.unnecessary.opt_in.remove.annotation.fix.family.name=Remove annotation
\ No newline at end of file
inspection.unnecessary.opt_in.remove.annotation.fix.family.name=Remove annotation
wrap.expression.in.parentheses=Wrap expression in parentheses
\ No newline at end of file
<html>
<body>
<p>Reports ambiguous logical expressions in <code>when</code> branches which cause compilation errors in Kotlin 1.8 and later.</p>
<pre><code>
fun Int.matches(strict: Boolean): Boolean = when (strict) {
true -> this == 6
this in (4..7) -> true // is ambiguous
else -> false
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
fun Int.matches(strict: Boolean): Boolean = when (strict) {
true -> this == 6
(this in (4..7)) -> true // wrapped in parentheses
else -> false
}
</code></pre>
<p>Inspection is available for Kotlin language level starting from 1.7.</p>
</body>
</html>
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.inspections.migration
import com.intellij.codeInspection.CleanupLocalInspectionTool
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.diagnostics.DiagnosticFactoryWithPsiElement
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.configuration.MigrationInfo
import org.jetbrains.kotlin.idea.configuration.isLanguageVersionUpdate
import org.jetbrains.kotlin.idea.quickfix.migration.MigrationFix
class AmbiguousExpressionInWhenBranchMigrationInspection :
AbstractDiagnosticBasedMigrationInspection<PsiElement>(PsiElement::class.java),
MigrationFix,
CleanupLocalInspectionTool {
override fun isApplicable(migrationInfo: MigrationInfo): Boolean {
return migrationInfo.isLanguageVersionUpdate(LanguageVersion.KOTLIN_1_6, LanguageVersion.KOTLIN_1_7)
}
override fun descriptionMessage(): String = KotlinBundle.message("inspection.ambiguous.expression.when.branch.migration.display.name")
override val diagnosticFactory: DiagnosticFactoryWithPsiElement<PsiElement, *>
get() = Errors.CONFUSING_BRANCH_CONDITION.warningFactory
}
\ No newline at end of file
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.quickfix
import com.intellij.codeInsight.intention.IntentionAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtPsiFactory
import org.jetbrains.kotlin.psi.createExpressionByPattern
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
class ConfusingExpressionInWhenBranchFix(element: KtExpression) : KotlinPsiOnlyQuickFixAction<KtExpression>(element) {
companion object : QuickFixesPsiBasedFactory<PsiElement>(PsiElement::class, PsiElementSuitabilityCheckers.ALWAYS_SUITABLE) {
override fun doCreateQuickFix(psiElement: PsiElement): List<IntentionAction> {
val expression = psiElement.safeAs<KtExpression>() ?: return emptyList()
return listOf(ConfusingExpressionInWhenBranchFix(expression))
}
}
override fun isAvailable(project: Project, editor: Editor?, file: KtFile): Boolean = element != null
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
val expression = element ?: return
val wrapped = KtPsiFactory(file).createExpressionByPattern("($0)", expression)
expression.replace(wrapped)
}
override fun getText(): String {
return KotlinBundle.message("wrap.expression.in.parentheses")
}
override fun getFamilyName(): String = text
}
\ No newline at end of file
......@@ -741,5 +741,6 @@ class QuickFixRegistrar : QuickFixContributor {
NOTHING_TO_OVERRIDE.registerFactory(MakeUpperBoundNonNullableFix)
WRONG_NULLABILITY_FOR_JAVA_OVERRIDE.registerFactory(ChangeMemberFunctionSignatureFix)
CONFUSING_BRANCH_CONDITION.registerFactory(ConfusingExpressionInWhenBranchFix)
}
}
......@@ -15893,6 +15893,19 @@ public abstract class QuickFixTestGenerated extends AbstractQuickFixTest {
}
}
 
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("testData/quickfix/wrapWhenExpressionInParentheses")
public static class WrapWhenExpressionInParentheses extends AbstractQuickFixTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("logicalExpressionInWhen.kt")
public void testLogicalExpressionInWhen() throws Exception {
runTest("testData/quickfix/wrapWhenExpressionInParentheses/logicalExpressionInWhen.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("testData/quickfix/wrapWithSafeLetCall")
public static class WrapWithSafeLetCall extends AbstractQuickFixTest {
......
// "Wrap expression in parentheses" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'true', 'false' branches or 'else' branch instead
interface A {
operator fun contains(other: A): Boolean
}
fun test(x: A, b: Boolean) {
when (b) {
x in x<caret> -> {}
}
}
\ No newline at end of file
// "Wrap expression in parentheses" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'true', 'false' branches or 'else' branch instead
interface A {
operator fun contains(other: A): Boolean
}
fun test(x: A, b: Boolean) {
when (b) {
(x in x) -> {}
}
}
\ No newline at end of file
......@@ -2397,6 +2397,15 @@
language="kotlin"
key="inspection.redundant.label.migration.display.name" bundle="messages.KotlinBundle"/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.migration.AmbiguousExpressionInWhenBranchMigrationInspection"
groupPath="Kotlin"
groupBundle="messages.KotlinBundle" groupKey="group.names.migration"
enabledByDefault="false"
cleanupTool="true"
level="WARNING"
language="kotlin"
key="inspection.ambiguous.expression.when.branch.migration.display.name" bundle="messages.KotlinBundle"/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.migration.AddConversionCallMigrationInspection"
groupPath="Kotlin"
groupBundle="messages.KotlinBundle" groupKey="group.names.migration"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment