Boolean operations in JS-backend DO perform short-circuit

Consider the following example:

class ShortCircuitTest {
    @Test
    fun test() {
        myPrint(1, true) or myPrint(2, true)
        myPrint(3, false) and myPrint(4, false)
    }

    fun myPrint(x: Int, r: Boolean): Boolean {
        print(x)
        return r
    }
}

The JVM backend will print 1234, while the JS backend prints 13.

I guess the JS behavior should be different.

I use kotlin-1.2.0-beta-88.
In that version the doc explicitly states that these functions do not perform short-circuit evaluation (kotlin/Boolean.kt at 1.2-Beta · JetBrains/kotlin · GitHub).
In the 1.1 docs that sentence isn’t there.

I checked the produced JS code:

    this.myPrint_fzusl$(1, true) || this.myPrint_fzusl$(2, true);
    this.myPrint_fzusl$(3, false) && this.myPrint_fzusl$(4, false);

I guess if that were | and &, it would yield the expected behaviour.

Hello. It’s definitely a bug. I created KT-21004 on YT. Please, report bugs on YT the next time you find one.