it's just a matter of the order of operations bein...
# announcements
k
it's just a matter of the order of operations being different from what you expected. There's no bug here, though it's definitely a gotcha and I think a lint check would be great
a
There is a bug though in Android Studio related to this. There is an intention “Remove braces from ‘else’ statement” that changes the semantics of the program. Refactoring should not have any effect on the execution of the program, so I’d say that’s a bug there. For example, applying this intention to this code:
Copy code
fun foo(bar: Boolean): Int {
    return if (bar) {
        "1234"
    } else {
        "56"
    }.length
}
breaks it so that it does not compile anymore. (I didn’t read the whole thread, so sorry if this has already been mentioned)
k
@arekolek sounds like something you should file a bug report for in Youtrack