map.get() with not-null assertion: add quick-fixes
#KT-30010 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
84a3239cdf
commit
d67c793a9b
@@ -1,3 +1,4 @@
|
||||
// FIX: Replace with 'getValue' call
|
||||
// WITH_RUNTIME
|
||||
fun test(map: Map<Int, String>) {
|
||||
val s = map.get(1)!!<caret>
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Replace with 'getValue' call
|
||||
// WITH_RUNTIME
|
||||
fun test(map: Map<Int, String>) {
|
||||
val s = map.getValue(1)<caret>
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Replace with 'getValue' call
|
||||
// WITH_RUNTIME
|
||||
fun test(map: Map<Int, String>) {
|
||||
val s = map[1]<caret>!!
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Replace with 'getValue' call
|
||||
// WITH_RUNTIME
|
||||
fun test(map: Map<Int, String>) {
|
||||
val s = map.getValue(1)<caret>
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// FIX: Replace with '?: error("")'
|
||||
// WITH_RUNTIME
|
||||
fun test(map: Map<Int, String>) {
|
||||
val s = map[1]<caret>!!
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// FIX: Replace with '?: error("")'
|
||||
// WITH_RUNTIME
|
||||
fun test(map: Map<Int, String>) {
|
||||
val s = map[1] ?: error("<caret>")
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// FIX: Replace with 'getOrElse' call
|
||||
// DISABLE-ERRORS
|
||||
// WITH_RUNTIME
|
||||
fun test(map: Map<Int, String>) {
|
||||
val s = map[1]<caret>!!
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
// FIX: Replace with 'getOrElse' call
|
||||
// DISABLE-ERRORS
|
||||
// WITH_RUNTIME
|
||||
fun test(map: Map<Int, String>) {
|
||||
val s = map.getOrElse(1) { <caret> }
|
||||
}
|
||||
Reference in New Issue
Block a user