Add quick-fix "Replace with safe call & elvis" #KT-17815 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
c2707bb81b
commit
af53a0ecd5
@@ -0,0 +1,7 @@
|
||||
// "Replace with safe (?.) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(array: Array<String>?) {
|
||||
var s = ""
|
||||
s = array[0]<caret>
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Replace with safe (?.) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(array: Array<String>?) {
|
||||
var s = ""
|
||||
s = array?.get(0) ?: <caret>
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Replace with safe (?.) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(bar: Int?) {
|
||||
var i: Int = 1
|
||||
i = bar +<caret> 1
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Replace with safe (?.) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(bar: Int?) {
|
||||
var i: Int = 1
|
||||
i = bar?.plus(1) ?: <caret>
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace with safe (?.) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun bar() {
|
||||
val fff: (() -> Int)? = { 1 }
|
||||
var i: Int = 1
|
||||
i = fff<caret>()
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with safe (?.) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun bar() {
|
||||
val fff: (() -> Int)? = { 1 }
|
||||
var i: Int = 1
|
||||
i = fff?.invoke() ?: <caret>
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Replace with safe (?.) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(list: List<String>?) {
|
||||
var s = ""
|
||||
s = list[0]<caret>
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Replace with safe (?.) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(list: List<String>?) {
|
||||
var s = ""
|
||||
s = list?.get(0) ?: <caret>
|
||||
}
|
||||
Reference in New Issue
Block a user