Quick-fix for reassignment in try / catch (fold to assignment) #KT-13778 Fixed
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// "Lift assignment out of 'try' expression" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
val x: Int
|
||||
try {
|
||||
x = 1
|
||||
}
|
||||
catch (e: RuntimeException) {
|
||||
<caret>x = 2
|
||||
}
|
||||
catch (e: Exception) {
|
||||
x = 3
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
x = 4
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user