KT-14084 related : replaceFirstReceiver now replaces ALL calls to safe calls if necessary

Fixes relevant "replace let" and "if to elvis" cases
This commit is contained in:
Mikhail Glukhikh
2016-10-25 16:14:43 +03:00
parent 2117b30b76
commit a901de5112
6 changed files with 21 additions and 5 deletions
@@ -0,0 +1,5 @@
class My(val x: Int)
fun foo(arg: Any?): Int {
return if (<caret>arg is My) arg.x.hashCode() else 42
}
@@ -0,0 +1,5 @@
class My(val x: Int)
fun foo(arg: Any?): Int {
return (arg as? My)?.x?.hashCode() ?: 42
}
@@ -4,6 +4,6 @@
fun foo() {
val foo: String? = null
foo?.let {
it.to("").to("")<caret>
it.hashCode().hashCode()<caret>
}
}
@@ -3,5 +3,5 @@
fun foo() {
val foo: String? = null
foo?.to("").to("")
foo?.hashCode()?.hashCode()
}