"Useless call on collection type" inspection: Apply to 'kotlin.sequences.orEmpty'
This commit is contained in:
committed by
Ilya Gorbunov
parent
c4b785de36
commit
6a140fb9ed
+1
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.types.TypeUtils
|
||||
|
||||
class UselessCallOnNotNullInspection : AbstractUselessCallInspection() {
|
||||
override val uselessFqNames = mapOf("kotlin.collections.orEmpty" to deleteConversion,
|
||||
"kotlin.sequences.orEmpty" to deleteConversion,
|
||||
"kotlin.text.orEmpty" to deleteConversion,
|
||||
"kotlin.text.isNullOrEmpty" to Conversion("isEmpty"),
|
||||
"kotlin.text.isNullOrBlank" to Conversion("isBlank"))
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(s: Sequence<Int>) {
|
||||
val foo = s<caret>.orEmpty()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(s: Sequence<Int>) {
|
||||
val foo = s
|
||||
}
|
||||
+5
@@ -1284,6 +1284,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
runTest("idea/testData/inspectionsLocal/collections/uselessCallOnNotNull/SafeCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Sequence.kt")
|
||||
public void testSequence() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/collections/uselessCallOnNotNull/Sequence.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("String.kt")
|
||||
public void testString() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/collections/uselessCallOnNotNull/String.kt");
|
||||
|
||||
Reference in New Issue
Block a user