Edoardo Luppi
09/20/2026, 1:13 PMsuspend fun example, what's the role of the suspendBridge?
class TestExport {
*example_1u0ivn_k$($completion) {
println('example');
return Unit_instance;
}
example() {
return promisify(($completion) => this.example_1u0ivn_k$($completion));
}
*example$suspendBridge_5xvqmk_k$($completion) {
if (this.example === protoOf(TestExport).example)
yield* this.example_1u0ivn_k$($completion);
else
yield* await_0(this.example(), $completion);
return Unit_instance;
}
}Edoardo Luppi
09/20/2026, 1:46 PMPrepareSuspendFunctionsForExportLowering has a brief explanation in its KDoc. Although I don't completely understand what
> This function is used on the call side
means in this context as that *example$suspendBridge_5xvqmk_k$ function is never called in the bundle.Artem Kobzar
09/20/2026, 6:27 PMexample function we replace the call with the call of the suspendBridge, so that if the method is overriden from TypeScript we would call typescript version with await , otherwise just Kotlin suspend function.
We actually can remove such bridge for final classes if we find a way to declare prevent extending them on the TypeScript levelEdoardo Luppi
09/20/2026, 6:34 PM*example$suspendBridge_5xvqmk_k$? Maybe this specific case is "strange" or I just don't have a proper example, but the fact it's never called in the bundle makes me think the only "rule" could be: is the class open or not?Artem Kobzar
09/20/2026, 6:36 PM__doNotUseItOrImplementIt property)Edoardo Luppi
09/20/2026, 6:42 PMexample, never the bridge. Probably I'm missing the bigger picture.