Convert IfThenToElvisIntention to inspection & decrease severity to INFO
#KT-16067 Fixed
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.branchedTransformations.IfThenToElvisInspection
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun <T> doSomething(a: T) {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo = null
|
||||
val a = "a"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo: String? = "foo"
|
||||
if (null == <caret>null) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
operator fun <T> T.compareTo(a: T): Int = 0
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// ERROR: Type mismatch: inferred type is Int but Boolean was expected
|
||||
// ERROR: Type mismatch: inferred type is Int but Boolean was expected
|
||||
// ERROR: Operator call corresponds to a dot-qualified call 'foo.times(10)' which is not allowed on a nullable receiver 'foo'.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo = "foo"
|
||||
val bar = "foo"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo: String? = null
|
||||
if (foo != null<caret>) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo: String? = "foo"
|
||||
val bar = "bar"
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>ifAsPartOfExpression.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>ifAsPartOfExpression</package>
|
||||
<entry_point TYPE="method" FQNAME="ifAsPartOfExpression.IfAsPartOfExpressionKt void main(java.lang.String[] args)" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>comparisonInElse.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>comparisonInElse</package>
|
||||
<entry_point TYPE="method" FQNAME="comparisonInElse.ComparisonInElseKt boolean foo(comparisonInElse.Your your)" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>willNotInlineClassProperty.kt</file>
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>willNotInlineClassProperty</package>
|
||||
<entry_point TYPE="field" FQNAME="willNotInlineClassProperty.F c" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>applicableForLocalStableVar.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>applicableForLocalStableVar</package>
|
||||
<entry_point TYPE="method" FQNAME="applicableForLocalStableVar.ApplicableForLocalStableVarKt java.lang.String test()" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>nullCheckWithSelector.kt</file>
|
||||
<line>4</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>nullCheckWithSelector</package>
|
||||
<entry_point TYPE="method" FQNAME="nullCheckWithSelector.NullCheckWithSelectorKt int foo(nullCheckWithSelector.My arg)" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>nullCheckWithSelectorCall.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>nullCheckWithSelectorCall</package>
|
||||
<entry_point TYPE="field" FQNAME="nullCheckWithSelectorCall.NullCheckWithSelectorCallKt foo" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>implicitReceiver.kt</file>
|
||||
<line>2</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>implicitReceiver</package>
|
||||
<entry_point TYPE="method" FQNAME="implicitReceiver.ImplicitReceiverKt boolean foo(java.lang.String $self)" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>nullCheckWithSelectorCallChain.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>nullCheckWithSelectorCallChain</package>
|
||||
<entry_point TYPE="field" FQNAME="nullCheckWithSelectorCallChain.NullCheckWithSelectorCallChainKt foo" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>extensionFunctionInClass.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>extensionFunctionInClass</package>
|
||||
<entry_point TYPE="method" FQNAME="extensionFunctionInClass.ExtensionFunctionInClassKt int test(extensionFunctionInClass.Foo $self, extensionFunctionInClass.Foo foo)" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>doesNotInlineVariableInMultiDeclaration.kt</file>
|
||||
<line>7</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>doesNotInlineVariableInMultiDeclaration</package>
|
||||
<entry_point TYPE="method" FQNAME="doesNotInlineVariableInMultiDeclaration.DoesNotInlineVariableInMultiDeclarationKt int f(doesNotInlineVariableInMultiDeclaration.IntPair pair)" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>ifAsExpression.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package>ifAsExpression</package>
|
||||
<entry_point TYPE="method" FQNAME="ifAsExpression.IfAsExpressionKt void main(java.lang.String[] args)" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>If-Then foldable to '?:'</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.branchedTransformations.IfThenToElvisInspection
|
||||
// WITH_RUNTIME
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
fun foo(x: CharSequence?) {
|
||||
val y = if (x is String?) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
interface A
|
||||
interface B
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo: String? = "foo"
|
||||
if (foo == null<caret>) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo: String? = "foo"
|
||||
val bar = "bar"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo: String? = "foo"
|
||||
val bar = "bar"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo = "foo"
|
||||
val bar = "bar"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun maybeFoo(): String? {
|
||||
return "foo"
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun maybeFoo(): String? {
|
||||
return "foo"
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
fun main(args: Array<String>) {
|
||||
val t: String? = "abc"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
fun main(args: Array<String>) {
|
||||
val t: String? = "abc"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo: String? = "foo"
|
||||
if (foo == null<caret>) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
class Something {
|
||||
fun nullable(): Int? = null
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
fun foo(p: String?): String? {
|
||||
return <caret>if (p != null) p.bar() else "a"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun <T> doSomething(a: T) {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun main(args: Array<String>) {
|
||||
val foo = null
|
||||
if (foo == null<caret>) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
open class Some {
|
||||
fun bar() {}
|
||||
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToElvisIntention
|
||||
@@ -1,90 +0,0 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>willNotInlineClassProperty.kt</file>
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/src/willNotInlineClassProperty.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'.</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>ifAsExpression.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/src/ifAsExpression.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'.</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>ifAsPartOfExpression.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/src/ifAsPartOfExpression.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'.</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>doesNotInlineVariableInMultiDeclaration.kt</file>
|
||||
<line>7</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/src/doesNotInlineVariableInMultiDeclaration.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'.</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>nullCheckWithSelector.kt</file>
|
||||
<line>4</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="nullCheckWithSelector.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>nullCheckWithSelectorCall.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="nullCheckWithSelectorCall.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>nullCheckWithSelectorCallChain.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="nullCheckWithSelectorCallChain.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>comparisonInElse.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/comparisonInElse.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>implicitReceiver.kt</file>
|
||||
<line>2</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/implicitReceiver.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>applicableForLocalStableVar.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/applicableForLocalStableVar.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>extensionFunctionInClass.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/extensionFunctionInClass.kt" />
|
||||
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?:'</problem_class>
|
||||
<description>Replace 'if' expression with elvis expression</description>
|
||||
</problem>
|
||||
</problems>
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToElvisInspection
|
||||
// WITH_RUNTIME
|
||||
Reference in New Issue
Block a user