Convert ReplaceSubstringIntention to ReplaceSubstringInspection
Relates to #KT-31502
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.substring.ReplaceSubstringWithDropLastInspection
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A(val x: String)
|
||||
|
||||
fun foo(a: A) {
|
||||
a.x.substring<caret>(0, a.x.length - 5)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A(val x: String)
|
||||
|
||||
fun foo(a: A) {
|
||||
a.x.dropLast(5)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class A() {
|
||||
fun bar(): String = null!!
|
||||
}
|
||||
|
||||
fun foo(a: A) {
|
||||
a.bar().substring<caret>(0, a.bar().length - 5)
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(3, s.length - 5)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(0, s.length - 5)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.dropLast(5)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(0, s.length - 5);
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.dropLast(5);
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.substring.ReplaceSubstringWithIndexingOperationInspection
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
"abc".substring<caret>(1, 2)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
"abc"[1]
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
"abc".substring<caret>(0, 1)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
"abc"[0]
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
"abc".substring<caret>(0, 10)
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.substring.ReplaceSubstringWithSubstringAfterInspection
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A(val x: String)
|
||||
|
||||
fun foo(a: A) {
|
||||
a.x.substring<caret>(a.x.indexOf('x'))
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A(val x: String)
|
||||
|
||||
fun foo(a: A) {
|
||||
a.x.substringAfter('x')
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class A() {
|
||||
fun bar(): String = null!!
|
||||
}
|
||||
|
||||
fun foo(a: A) {
|
||||
a.bar().substring<caret>(a.bar().indexOf('x'))
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(s.indexOf('x'))
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substringAfter('x')
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(s.indexOf('x'));
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substringAfter('x');
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.substring.ReplaceSubstringWithSubstringBeforeInspection
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A(val x: String)
|
||||
|
||||
fun foo(a: A) {
|
||||
a.x.substring<caret>(0, a.x.indexOf('x'))
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A(val x: String)
|
||||
|
||||
fun foo(a: A) {
|
||||
a.x.substringBefore('x')
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class A() {
|
||||
fun bar(): String = null!!
|
||||
}
|
||||
|
||||
fun foo(a: A) {
|
||||
a.bar().substring<caret>(0, a.bar().indexOf('x'))
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(1, s.indexOf('x'))
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(0, s.indexOf('x'))
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substringBefore('x')
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(0, s.indexOf('x'));
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substringBefore('x');
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.substring.ReplaceSubstringWithTakeInspection
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
const val x = 0
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(x, 10)
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(1 - 1, 10)
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(1, 10)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(0, 10)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.take(10)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.substring<caret>(0, 10);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.take(10);
|
||||
}
|
||||
Reference in New Issue
Block a user