Hello everyone,
I wonder if this is a bug in Android Studio (Narwhal 2025.1.2 Patch1)
When I have this code:
if (width > 0) {
set(WIDTH, width.toString())
} else if (height > 0) {
set(HEIGHT, height.toString())
}
append(DPR, "${screen.densityScale}")
and then ask to replace the if with a when statement ("Replace 'if' with 'when'" action), then this is the result:
when {
width > 0 -> {
set(WIDTH, width.toString())
}
height > 0 -> {
set(HEIGHT, height.toString())
}
else -> append(DPR, "${screen.densityScale}")
}
the
append
call should NOT appear in the
else
branch. Instead, shouldn't it stay outside the when-statement?
Is this a bug?