Hello everyone, I wonder if this is a bug in Andr...
# android-studio
s
Hello everyone, I wonder if this is a bug in Android Studio (Narwhal 2025.1.2 Patch1) When I have this code:
Copy 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:
Copy code
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?
c
not too many folks from the studio team are on this slack. id likely just file a bug and see what they say.
👍 2