FoldInitializerAndIfToElvisInspection: don't add explicit type if var is used as non-nullable
#KT-38349 Fixed
This commit is contained in:
committed by
Yan Zhulanow
parent
3e632d074e
commit
bb7d4c224f
-1
@@ -1,4 +1,3 @@
|
||||
// PROBLEM: none
|
||||
fun test(foo: Int?, bar: Int): Int {
|
||||
var i = foo
|
||||
<caret>if (i == null) {
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
fun test(foo: Int?, bar: Int): Int {
|
||||
var i = foo ?: return bar
|
||||
return i
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// PROBLEM: none
|
||||
fun test(foo: Int?, bar: Int): Int {
|
||||
var i = foo
|
||||
<caret>if (i == null) {
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fun test(foo: Int?, bar: Int): Int {
|
||||
var i = foo ?: return bar
|
||||
baz(i)
|
||||
val j = i + 1
|
||||
return j
|
||||
}
|
||||
|
||||
fun baz(i: Int?) {}
|
||||
Reference in New Issue
Block a user