Add "map.get() with not-null assertion operator" inspection #KT-25171 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-10-25 23:46:30 +09:00
committed by Mikhail Glukhikh
parent c5c0cbccde
commit d3908aeb2e
13 changed files with 156 additions and 1 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.MapGetWithNotNullAssertionOperatorInspection
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(map: Map<Int, String>) {
val s = map.get(1)!!<caret>
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(map: Map<Int, String>) {
val s = map.getValue(1)<caret>
}
@@ -0,0 +1,5 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(map: Map<Int, String>) {
val s = map.getValue(1)!!<caret>
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(map: Map<Int, String>) {
val s = map[1]<caret>!!
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(map: Map<Int, String>) {
val s = map.getValue(1)<caret>
}
@@ -0,0 +1,5 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(list: List<String>) {
val s = list.get(1)!!<caret>
}
@@ -0,0 +1,5 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(map: Map<Int, String>) {
val s = map.get(1)<caret>
}