Skip to content

[Wasm] support companion object in external interface (KT-76462)#5867

Open
alex28sh wants to merge 7 commits intomasterfrom
rr/shefer/companion-object-in-external-interface
Open

[Wasm] support companion object in external interface (KT-76462)#5867
alex28sh wants to merge 7 commits intomasterfrom
rr/shefer/companion-object-in-external-interface

Conversation

@alex28sh
Copy link
Copy Markdown
Contributor

@alex28sh alex28sh commented Apr 14, 2026

Eliminates getters of companion object from external interfaces for inlined extension properties/methods. It relies on the structure of inlined blocks

                  VAR IR_TEMPORARY_VARIABLE name:tmp0 type:<root>.CanvasFillRule.Companion [val]
                    GET_OBJECT 'CLASS OBJECT name:Companion modality:FINAL visibility:public [companion,external] superTypes:[kotlin.Any]' type=<root>.CanvasFillRule.Companion
                  RETURNABLE_BLOCK type=<root>.CanvasFillRule origin=null
                    INLINED_BLOCK type=<root>.CanvasFillRule origin=null
                      inlinedFunctionSymbol: public final fun <get-ODDEVEN> (<this>: <root>.CanvasFillRule.Companion): <root>.CanvasFillRule [inline] declared in <root>
                      inlinedFunctionFileEntry: FILE_ENTRY path:/kt59082.kt
                      VAR IR_TEMPORARY_VARIABLE_FOR_INLINED_PARAMETER name:this type:<root>.CanvasFillRule.Companion [val]
                        GET_VAR 'val tmp0: <root>.CanvasFillRule.Companion [val] declared in <root>.box' type=<root>.CanvasFillRule.Companion origin=null
                      RETURN type=kotlin.Nothing from='{IrReturnableBlockImpl}'
                        CALL 'public final fun unsafeCast <T> (<this>: kotlin.js.JsAny): T of kotlin.js.unsafeCast declared in kotlin.js' type=<root>.CanvasFillRule origin=null
                          TYPE_ARG T: <root>.CanvasFillRule
                          ARG <this>: CALL 'public final fun toJsString (<this>: kotlin.String): kotlin.js.JsString declared in kotlin.js' type=kotlin.js.JsString origin=null
                            ARG <this>: CONST String type=kotlin.String value="oddeven"

Potentially, this could lead to losing side-effects when companion object actually exists on Js side

@kotlin-safe-merge
Copy link
Copy Markdown

kotlin-safe-merge Bot commented Apr 14, 2026

@alex28sh alex28sh force-pushed the rr/shefer/companion-object-in-external-interface branch from 15aabdf to c69fb5c Compare April 15, 2026 12:09
@JetBrains JetBrains deleted a comment from KotlinBuild Apr 15, 2026
@alex28sh
Copy link
Copy Markdown
Contributor Author

/test-public

@KotlinBuild
Copy link
Copy Markdown

Triggered a retry attempt №1 out of 1.

@KotlinBuild
Copy link
Copy Markdown

Quality gate failed. See https://buildserver.labs.intellij.net/build/926972501 to get full insight.

@jmrtsh jmrtsh self-requested a review April 20, 2026 09:15
@jmrtsh jmrtsh assigned jmrtsh and unassigned jmrtsh Apr 20, 2026
@jmrtsh jmrtsh removed their request for review April 20, 2026 09:45
@alex28sh alex28sh force-pushed the rr/shefer/companion-object-in-external-interface branch from 04c1a96 to d6f241f Compare April 21, 2026 14:58
@alex28sh alex28sh requested a review from bashor April 22, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants