Hi, I think I found a KotlinJS compiler bug. I know I should report this via YouTrack (and I will) but I just wanted to double check here:
class ProducesUninitializedTmpVarInJs(private val bar: (idx: Int) -> Boolean) {
private var idx = 0
fun foo(): Boolean = true && bar(idx++)
}
/*
ProducesUninitializedTmpVarInJs.prototype.foo = function () {
var tmp$, tmp$_0, tmp$_1, tmp$_2;
tmp$_2 = tmp$_1(tmp$_0); // tmp$1 is 'undefined' at this place!!!
if (true) {
tmp$_1 = this.bar_0;
tmp$_0 = (tmp$ = this.idx_0, this.idx_0 = tmp$ + 1 | 0, tmp$);
}
else
tmp$_2 = false;
return tmp$_2;
};
*/
As you can see tmp$1 is ‘undefined’!