-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Scala 3 support #494
Scala 3 support #494
Conversation
Dependencies have been updated to versions supporting Scala 3, IntelliJ manages to sync the project, this is a nice first step. Introduces a new source folders `scala-2` & `scala-3`, for now the assumption is that `scala-2.13+` will be included for Scala 3. Set Scala 3 as default version.
Read/Write is now split between Scala 2&3, Scala 2 compiles as before, Scala 3 is still missing an implementation.
Macros in Core is now split between Scala 2&3, Scala 2 compiles as before, Scala 3 is still missing an implementation.
…mplicits to fix self-ref
Very impressive, great to see that you were able to get support for recursive case classes, value classes and default values, is there any outstanding issues then for read/write? I guess opaque types and Scala 3 enums might not work yet, but most important thing now is parity with Scala 2, in my opinion at least.
|
This is absolutely incredible! Am wrapping up my summer internship this/next week, but will try to look through the details this weekend! |
@shadaj thanks, and good luck! |
tests/src/test/scala/slinky/core/annotations/LocalImportsComponent.scala
Outdated
Show resolved
Hide resolved
I think for the first pass, we should ignore |
28ba520
to
ae1bc92
Compare
Looks like Scala.js is only available on 2.12.14 since 1.5.1, and I'm not sure what's the lowest version that targets Scala 3. There's no 0.6.x for the most modern versions of Scala 2.12, 2.13 and 3.x either. I can downgrade Scala-2 versions back to where 0.6 existed and skip building for 3 if ScalaJS is not 1.x, though not sure if maintaining the 0.6 build is worth the trouble. No idea what to do with dependent types yet - the thing is, we need to have a value (maybe an erased one would work) to project the type out. So the |
@oleg-py I'd be fine with dropping 0.6 builds, since this PR will be part of the 0.7.0 release and by now hopefully most users will have moved over to Scala.js 1.0. For |
@oleg-py it seems like there's a fair bit of demand for partial Scala 3 support, so let's see if we can get this merged! I think the current set of supported features should be fine ( Looks like right now CI is failing due to style checks? |
Looks like |
It's great that the build is passing! I think it's reasonable to drop Scala.js 0.6 support now, since the vast majority of the ecosystem has moved away from 0.6. Will look through the changes in more detail later this week! |
history/build.sbt
Outdated
@@ -2,7 +2,7 @@ enablePlugins(ScalaJSPlugin) | |||
|
|||
name := "slinky-history" | |||
|
|||
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "1.1.0" | |||
libraryDependencies += ("org.scala-js" %%% "scalajs-dom" % "1.1.0").cross(CrossVersion.for3Use2_13) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libraryDependencies += ("org.scala-js" %%% "scalajs-dom" % "1.1.0").cross(CrossVersion.for3Use2_13) | |
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.0.0" |
We have an RC out with proper Scala 3 support, v2 final following shortly.
#511
scala-js/scala-js-dom#595
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readWrite/src/main/scala-3/slinky/readwrite/TypeConstructorReaders.scala
Outdated
Show resolved
Hide resolved
Couple of nits, but looks great overall! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks great! One final ask (sorry for forgetting this in the previous review): could you add this to the changelog? Probably can also include a few sub bulletpoints explaining that @react
isn't supported (and any other Reader/Writer limitations) and also that Scala.js 0.6.x isn't supported anymore.
Co-authored-by: Arman Bilge <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Asamsig has largely done cross-build setup, I've managed to, for the most part, port the reader/writer and other macros used to Scala 3. VR and native modules still don't compile since they use
@react
. I didn't test those extensively, just made sure it works with existing test suite (wherever@react
isn't used)The big sneaky change is that
js.|
is now Scala 3 union type, which behaves very differently (more natural wrt usage and more crazy when it comes to macros and implicit resolution).There are also a lot of warnings related to machinery used for attribute type-safety, since type projections of form
T#tagType
are disallowed. The code currently compiles with-source:3.0-migration
flag though, but I'm unsure if that's going to actually work in user-land (and that flag is really bad for some Scala 3 features and prevents some new syntax from working, so slinky users wouldn't want that).Not too sure what the plans are for
@react
-style DSL. It would definitely be a huge pain for me to write code likeInput.component(Input.Props(...))
. I've been looking into making that convenient, and while you can't synthesize members, it's potentially possible to useDynamic
with a macro. I, however, was unable to figure out a macro rewrite fromInput(...)
to that above construct that would support named parameters.