Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler plugin: fix IrLinkageError with K/Js on Kotlin 1.9 #3557

Merged

Conversation

OliverO2
Copy link
Contributor

@OliverO2 OliverO2 commented Jun 7, 2023

Fixes #3556 – IrLinkageError if objects or abstract subclasses of AbstractProjectConfig exist in K/Js sources

This commit makes the Kotest compiler plugin skip non-instantiable classes and objects, which derive from AbstractProjectConfig.

Note: To use objects deriving from AbstractProjectConfig on K/Js, they must be referenced at least once in code that executes, otherwise they will be discarded (with the IDE warning "object ... is never used").

OliverO2 and others added 2 commits June 7, 2023 21:40
Fixes kotest#3556 – IrLinkageError if objects or abstract subclasses of
AbstractProjectConfig exist in K/Js sources

This commit makes the Kotest compiler plugin skip non-instantiable
classes and objects, which derive from AbstractProjectConfig.

Note: To use objects deriving from AbstractProjectConfig on K/Js, they
must be referenced at least once in code that executes, otherwise they
will be discarded (with the IDE warning "object ... is never used)".
@OliverO2
Copy link
Contributor Author

Hmm, wondering why the compiler plugin is part of the API check. There should probably be an exclusion defined in an apiValidation block for the binary compatibility validator.

@sksamuel Should I act upon this? If so, as part of this PR or a separate one, which would have to be merged first?

@OliverO2
Copy link
Contributor Author

Putting something like this in the top-level build.gradle.kts and then running apiDump would work:

apiValidation {
   ignoredPackages.addAll(
      listOf(
         "io.kotest.framework.multiplatform.embeddablecompiler",
         "io.kotest.framework.multiplatform.gradle",
         "io.kotest.framework.multiplatform.native"
      )
   )
}

@sksamuel
Copy link
Member

sksamuel commented Jun 11, 2023 via email

@sksamuel sksamuel self-requested a review June 16, 2023 08:10
@sksamuel sksamuel merged commit 3143993 into kotest:master Jun 16, 2023
19 checks passed
@sksamuel
Copy link
Member

Nice work :)

@OliverO2
Copy link
Contributor Author

Always a pleasure! :)

@OliverO2 OliverO2 deleted the issue/kotlin-1.9-js-irlinkageerror-3556 branch August 10, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants