https://kotlinlang.org logo
#announcements
Title
# announcements
k

kevinmost

09/19/2017, 9:53 PM
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

arekolek

09/20/2017, 10:06 AM
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

kevinmost

09/20/2017, 2:42 PM
@arekolek sounds like something you should file a bug report for in Youtrack