Convert ReplaceSubstringIntention to ReplaceSubstringInspection

Relates to #KT-31502
This commit is contained in:
Dmitry Gridin
2019-05-27 19:49:59 +07:00
parent 2310826ec9
commit 8988b4b344
77 changed files with 463 additions and 476 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.substring.ReplaceSubstringWithSubstringBeforeInspection
@@ -0,0 +1,7 @@
// WITH_RUNTIME
class A(val x: String)
fun foo(a: A) {
a.x.substring<caret>(0, a.x.indexOf('x'))
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
class A(val x: String)
fun foo(a: A) {
a.x.substringBefore('x')
}
@@ -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'))
}
@@ -0,0 +1,6 @@
// PROBLEM: none
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(1, s.indexOf('x'))
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(0, s.indexOf('x'))
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String) {
s.substringBefore('x')
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(0, s.indexOf('x'));
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String) {
s.substringBefore('x');
}