Support implicit receiver in if-then intentions #KT-16069 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
13a2612e20
commit
5df5a001a1
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
fun String?.foo() = if (this == <caret>null) throw NullPointerException() else this
|
||||
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
fun String?.foo() = this!!
|
||||
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
fun String?.foo() = <caret>if (this == null) true else isEmpty()
|
||||
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
fun String?.foo() = this?.isEmpty() ?: true
|
||||
@@ -95,4 +95,12 @@
|
||||
<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>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
fun String?.foo() = <caret>if (this == null) null else isEmpty()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
fun String?.foo() = this?.isEmpty()
|
||||
+8
@@ -143,4 +143,12 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">If-Then foldable to '?.'</problem_class>
|
||||
<description>Remove redundant 'if' 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>Remove redundant 'if' expression</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
Reference in New Issue
Block a user