Keep braces in redundant cascade if #KT-19704 Fixed
This commit is contained in:
@@ -39,4 +39,20 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Condition of 'if' expression is constant</problem_class>
|
||||
<description>Condition is always 'true'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>31</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Condition of 'if' expression is constant</problem_class>
|
||||
<description>Condition is always 'true'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>37</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Condition of 'if' expression is constant</problem_class>
|
||||
<description>Condition is always 'true'</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+11
-1
@@ -3,7 +3,7 @@ fun baz(s: String) {}
|
||||
|
||||
const val TRUE = true
|
||||
|
||||
fun bar() {
|
||||
fun bar(s: String?) {
|
||||
foo(if (TRUE) 1 else 2)
|
||||
|
||||
foo(if (false && TRUE) {
|
||||
@@ -25,4 +25,14 @@ fun bar() {
|
||||
baz("a")
|
||||
1
|
||||
} else 2)
|
||||
|
||||
if (s ==null) {
|
||||
1
|
||||
} else if (true) {
|
||||
2
|
||||
}
|
||||
|
||||
if (s ==null) {
|
||||
1
|
||||
} else if (true) 2
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(x: Int) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
1
|
||||
}
|
||||
else if (<caret>true) {
|
||||
2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(x: Int) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
1
|
||||
}
|
||||
else {
|
||||
2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(x: Int) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
1
|
||||
}
|
||||
else if (<caret>true) 2
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(x: Int) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
1
|
||||
}
|
||||
else 2
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(x: Int) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
1
|
||||
}
|
||||
else if (<caret>true) {
|
||||
foo(1)
|
||||
2
|
||||
}
|
||||
else {
|
||||
3
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(x: Int) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
1
|
||||
}
|
||||
else {
|
||||
foo(1)
|
||||
2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fun foo(s: String) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
foo("a")
|
||||
foo("b")
|
||||
}
|
||||
else if (<caret>true) {
|
||||
}
|
||||
else {
|
||||
foo("c")
|
||||
foo("d")
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(s: String) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
foo("a")
|
||||
foo("b")
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fun foo(s: String) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
1
|
||||
}
|
||||
else if (<caret>true) {
|
||||
foo("a")
|
||||
foo("b")
|
||||
2
|
||||
}
|
||||
else {
|
||||
3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fun foo(s: String) {}
|
||||
|
||||
fun bar(s: String?) {
|
||||
if (s == null) {
|
||||
1
|
||||
}
|
||||
else {
|
||||
foo("a")
|
||||
foo("b")
|
||||
2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user