-
Couldn't load subscription status.
- Fork 1.4k
Fix #5152: include .sjsir files when publishing for scalajs on scala 3 #5238
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
Conversation
|
Great news! Glad someone finally figured it out 👏 |
|
Ok, I think that I'm going to need some help fixing that I have taken a look but I don't quite know how to approach this. The test that fails to compile under scalajs is this one: test("Object constructor") {
assertTrue(zio.duration.Duration.fromNanos(1000) == zio.duration.Duration.Zero)
}The output of the macro is approximately this zio.test.Arrow.succeed[zio](zio)
.>>>[zio.duration](zio.test.Arrow.fromFunction[zio, zio.duration](((from: zio) => from.duration)))
.>>>[zio.duration.package.type](zio.test.Arrow.fromFunction[zio.duration, zio.duration.package.type]((from: zio.duration) => from))
.>>>[zio.duration.Duration.type](zio.test.Arrow.fromFunction[zio.duration.package.type, zio.duration.Duration.type]((from: zio.duration.package.type) => from.Duration))
.>>>[java.time.Duration](zio.test.Arrow.fromFunction[zio.duration.Duration.type, java.time.Duration]((from: zio.duration.Duration.type) => from.fromNanos(1000L)))
.>>>[scala.Boolean](zio.test.Assertions.equalTo[java.time.Duration](zio.duration.Duration.Zero)(zio.test.OptionalImplicit.none[zio.test.Diff[java.time.Duration]]))the first line already fails to translate to js with the error which makes sense? trying to compile that line with scalac will fail with the similar error why is this even working on the jvm? so I'm not sure what to do, should this be supported by scalajs, should the macro output something different, like zio.test.Arrow.succeed[zio.duration.Duration.type](zio.duration.Duration)
.>>>[java.time.Duration](zio.test.Arrow.fromFunction[zio.duration.Duration.type, java.time.Duration]((from: zio.duration.Duration.type) => from.fromNanos(1000L)))
.>>>[scala.Boolean](zio.test.Assertions.equalTo[java.time.Duration](zio.duration.Duration.Zero)(zio.test.OptionalImplicit.none[zio.test.Diff[java.time.Duration]]))or something else? |
|
Turns out this was not working on the jvm either, I opened a separate issue for that: #5244 |
|
@adamgfraser can we try running ci again to see if this works now? |
|
@roald-di can you rebase to the latest master, so that your other PR is included? That should re-trigger the CI. |
|
I just checked the JAR from the latest snapshot and .sjsir files are included 🎉 |
Fixes #5152
The problem was that the .sjsir files are only generated when the compiler gets passed the
-scalajsoption, this option is correctly added by the scalajs plugin but was then lost when setting scalac options.I also had to add a type signature in ZScope.scala as it would not compile with -scalajs, showing this error:
this is probably a compiler bug? I didn't want to invest a lot of time figuring this out since the workaround is pretty easy.
To validate my change I did a publishLocal and checked that the files are included.
I also verified with println that the original scalac options are always empty except for when they contain the single
-scalajsswitch, this means that the rest of the build should not be impacted by this change.