KT-11870 "Replace with Elvis" refactoring doesn't change the variable type from T? to T

#KT-11870 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-04-18 19:33:29 +03:00
parent 6bdf3622ed
commit e72e6bf7db
6 changed files with 57 additions and 6 deletions
@@ -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
}