FIR IDE: Remove multiple nested params in RemoveUselessElvisFix and

RemoveUselessCastFix.
This commit is contained in:
Mark Punzalan
2021-05-26 20:52:52 +00:00
committed by TeamCityServer
parent a778cc673e
commit d12a24418e
15 changed files with 148 additions and 6 deletions
@@ -0,0 +1,9 @@
// "Remove useless cast" "true"
fun foo() {}
fun test() {
foo()
// comment
((({ "" } as<caret> () -> String)))
}
/* IGNORE_FIR */
@@ -0,0 +1,9 @@
// "Remove useless cast" "true"
fun foo() {}
fun test() {
foo()
// comment
({ "" })
}
/* IGNORE_FIR */
@@ -0,0 +1,5 @@
// "Remove useless cast" "true"
fun test() {
((({ "" } as<caret> () -> String)))
}
/* IGNORE_FIR */
@@ -0,0 +1,5 @@
// "Remove useless cast" "true"
fun test() {
{ "" }
}
/* IGNORE_FIR */
@@ -0,0 +1,9 @@
// "Remove useless cast" "true"
fun test(x: Any): Int {
if (x is String) {
return (((x <caret>as String))).length
}
return -1
}
/* IGNORE_FIR */
@@ -0,0 +1,9 @@
// "Remove useless cast" "true"
fun test(x: Any): Int {
if (x is String) {
return x.length
}
return -1
}
/* IGNORE_FIR */
@@ -0,0 +1,8 @@
// "Remove useless elvis operator" "true"
fun foo() {}
fun test() {
foo()
// comment
((({ "" } <caret>?: null)))
}
@@ -0,0 +1,8 @@
// "Remove useless elvis operator" "true"
fun foo() {}
fun test() {
foo()
// comment
({ "" })
}
@@ -0,0 +1,4 @@
// "Remove useless elvis operator" "true"
fun test() {
((({ "" } <caret>?: null)))
}
@@ -0,0 +1,4 @@
// "Remove useless elvis operator" "true"
fun test() {
{ "" }
}
@@ -0,0 +1,4 @@
// "Remove useless elvis operator" "true"
fun foo(a: String) {
val b : String = (((a <caret>?: "s")))
}
@@ -0,0 +1,4 @@
// "Remove useless elvis operator" "true"
fun foo(a: String) {
val b : String = a<caret>
}