KT-11870 "Replace with Elvis" refactoring doesn't change the variable type from T? to T
#KT-11870 Fixed
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(): String? = null
|
||||
|
||||
fun bar() {
|
||||
val v: String? = foo()
|
||||
<caret>if (v == null) throw Exception()
|
||||
v.length
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(): String? = null
|
||||
|
||||
fun bar() {
|
||||
val v: String = foo() ?: throw Exception()
|
||||
v.length
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): String? = null
|
||||
|
||||
fun bar() {
|
||||
var v: String? = foo()
|
||||
<caret>if (v == null) throw Exception()
|
||||
v = null
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): String? = null
|
||||
|
||||
fun bar() {
|
||||
var v: String? = foo() ?: throw Exception()
|
||||
v = null
|
||||
}
|
||||
Reference in New Issue
Block a user