Quick-fix for reassignment in try / catch (fold to assignment) #KT-13778 Fixed
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// "Lift assignment out of 'try' expression" "false"
|
||||
// ACTION: Make variable mutable
|
||||
// ERROR: Val cannot be reassigned
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(arg: Boolean) {
|
||||
val x: Int
|
||||
try {
|
||||
if (arg) {
|
||||
x = 1
|
||||
}
|
||||
}
|
||||
catch (e: Exception) {
|
||||
<caret>x = 2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user