Move variable declaration into when: don't report when property has 'return' or 'throw'
#KT-31999 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
d9d04fc556
commit
877e583a96
@@ -0,0 +1,8 @@
|
||||
// PROBLEM: none
|
||||
fun test(str: String?): String? {
|
||||
val <caret>some = str ?: return null
|
||||
return when (some) {
|
||||
"some" -> some
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// PROBLEM: none
|
||||
fun test(str: String?): String? {
|
||||
val <caret>some = if (str != null) str + str else return null
|
||||
return when (some) {
|
||||
"some" -> some
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// PROBLEM: none
|
||||
fun test(str: String?): String? {
|
||||
val <caret>some = str ?: throw Exception()
|
||||
return when (some) {
|
||||
"some" -> some
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// PROBLEM: none
|
||||
fun test(str: String?): String? {
|
||||
val <caret>some = if (str != null) str + str else throw Exception()
|
||||
return when (some) {
|
||||
"some" -> some
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user