Inspection: convert initialized val to non-null type

^KT-35757 Fixed
This commit is contained in:
kvirolainen
2020-09-03 16:29:45 +02:00
committed by Vladimir Dolzhenko
parent 8b28e54584
commit 18fbf5729d
13 changed files with 149 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.ConvertInitializedValToNonNullTypeInspection
@@ -0,0 +1,5 @@
fun foo() {
val s1: String?<caret> = bar()
}
fun bar(): String = ""
@@ -0,0 +1,5 @@
fun foo() {
val s1: String = bar()
}
fun bar(): String = ""
@@ -0,0 +1,4 @@
fun foo() {
val s0: String = ""
val s1: String?<caret> = s0
}
@@ -0,0 +1,4 @@
fun foo() {
val s0: String = ""
val s1: String = s0
}
@@ -0,0 +1,3 @@
fun foo() {
val s: String?<caret> = "Hello"
}
@@ -0,0 +1,3 @@
fun foo() {
val s: String = "Hello"
}
@@ -0,0 +1,7 @@
// PROBLEM: none
fun foo() {
val s1: String? = bar()
val s2: String?<caret> = null
}
fun bar(): String? = ""