Convert FoldInitializerAndIfToElvisIntention to inspection and decrease severity to INFO
#KT-19643 Fixed
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.FoldInitializerAndIfToElvisInspection
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun foo(p: List<String?>): Int {
|
||||
val v = p[0]
|
||||
<caret>if (v != null) return -1
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
interface A {
|
||||
fun a() {}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
open class A
|
||||
|
||||
open class B : A() {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun foo(p: List<String?>) {
|
||||
val v = p[0]
|
||||
<caret>if (v == null) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun foo(p: List<String?>): Int? {
|
||||
val v = p[0]
|
||||
<caret>if (v == null) bar()
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun test(): String {
|
||||
val foo = foo()
|
||||
<caret>if (foo !is String?) return "0"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
class C {
|
||||
var v: String? = null
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
class C {
|
||||
var x: String? = null
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
interface A {
|
||||
val s: String
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
interface A {
|
||||
val s: String
|
||||
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.intentions.FoldInitializerAndIfToElvisIntention
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Suppress 'ConstantConditionIf' for fun foo" "true"
|
||||
|
||||
fun foo() {
|
||||
if (<caret>true) {
|
||||
}
|
||||
}
|
||||
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.ConstantConditionIfInspection
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Suppress 'ConstantConditionIf' for fun foo" "true"
|
||||
|
||||
@Suppress("ConstantConditionIf")
|
||||
fun foo() {
|
||||
if (true) {
|
||||
}
|
||||
}
|
||||
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.ConstantConditionIfInspection
|
||||
@@ -1,9 +0,0 @@
|
||||
// "Suppress 'FoldInitializerAndIfToElvis' for fun foo" "true"
|
||||
|
||||
fun foo(p: List<String?>, b: Boolean) {
|
||||
var v = p[0]
|
||||
<caret>if (v == null) return
|
||||
if (b) v = null
|
||||
}
|
||||
|
||||
// TOOL: org.jetbrains.kotlin.idea.intentions.FoldInitializerAndIfToElvisInspection
|
||||
@@ -1,10 +0,0 @@
|
||||
// "Suppress 'FoldInitializerAndIfToElvis' for fun foo" "true"
|
||||
|
||||
@Suppress("FoldInitializerAndIfToElvis")
|
||||
fun foo(p: List<String?>, b: Boolean) {
|
||||
var v = p[0]
|
||||
<caret>if (v == null) return
|
||||
if (b) v = null
|
||||
}
|
||||
|
||||
// TOOL: org.jetbrains.kotlin.idea.intentions.FoldInitializerAndIfToElvisInspection
|
||||
Reference in New Issue
Block a user