Add "Replace with 'equals(..., ignoreCase = true)'" inspection

#KT-40016 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-07-05 07:25:29 +09:00
committed by Vladimir Dolzhenko
parent a5bfa3ae63
commit d2deff4864
24 changed files with 252 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.ReplaceWithIgnoreCaseEqualsInspection
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun String.test(s: String): Boolean {
return <caret>toLowerCase() == s.toLowerCase()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun String.test(s: String): Boolean {
return equals(s, ignoreCase = true)
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun String.test(s: String): Boolean {
return <caret>s.toLowerCase() == toLowerCase()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun String.test(s: String): Boolean {
return s.equals(this, ignoreCase = true)
}
@@ -0,0 +1,5 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(a: String, b: String): Boolean {
return <caret>a.toLowerCase() != b.toLowerCase()
}
@@ -0,0 +1,5 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(a: String, b: String): Boolean {
return <caret>a == b.toLowerCase()
}
@@ -0,0 +1,5 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(a: String, b: String): Boolean {
return <caret>a.toLowerCase() == b
}
@@ -0,0 +1,5 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(a: String, b: String): Boolean {
return <caret>a.toLowerCase() == b.toUpperCase()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String?, b: String): Boolean {
return <caret>a?.toLowerCase() == b.toLowerCase()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String?, b: String): Boolean {
return a.equals(b, ignoreCase = true)
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String, b: String?): Boolean {
return <caret>a.toLowerCase() == b?.toLowerCase()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String, b: String?): Boolean {
return a.equals(b, ignoreCase = true)
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String?, b: String?): Boolean {
return <caret>a?.toLowerCase() == b?.toLowerCase()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String?, b: String?): Boolean {
return a.equals(b, ignoreCase = true)
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String, b: String): Boolean {
return <caret>a.toLowerCase() == b.toLowerCase()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String, b: String): Boolean {
return a.equals(b, ignoreCase = true)
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String, b: String): Boolean {
return <caret>a.toUpperCase() == b.toUpperCase()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(a: String, b: String): Boolean {
return a.equals(b, ignoreCase = true)
}