Edoardo Luppi
09/17/2026, 2:39 PMassertEquals(emptyList(), ["bbb"])
Translates to JS:
assertEquals(emptyList(), listOf('bbb'));
While
assertEquals([], ["bbb"])
Translates to JS:
var tmp$ret$0 = emptyList();
assertEquals(tmp$ret$0, listOf('bbb'));
I guess this is because [] translates to inline fun <T> listOf(): List<T> = _emptyList_()
Why not instead map [] directly to emptyList()?Edoardo Luppi
09/17/2026, 3:04 PMGrigorii Solnyshkin
09/18/2026, 12:55 PMof for standard library classes:
interface List<out T> {
...
companion {
inline operator fun <T> of(): List<T> = emptyList()
...
}
}
and will resolve collection literals to them so the current behavior is the closest approximation we can get.