IDEA plugin: fixed crashing ifExpressionToElvis intention when applying to if expression which is part of another expression.
#EA-57307 fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fun maybeFoo(): String? {
|
||||
return "foo"
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val foo = maybeFoo()
|
||||
val bar = "bar"
|
||||
val x = "baz" + if (foo == null<caret>) bar else foo
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fun maybeFoo(): String? {
|
||||
return "foo"
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val bar = "bar"
|
||||
val x = "baz" + (maybeFoo() ?: bar)
|
||||
}
|
||||
@@ -47,6 +47,14 @@
|
||||
<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>ifAndElseNotInBlocks.kt</file>
|
||||
<line>8</line>
|
||||
|
||||
Reference in New Issue
Block a user