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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Scala 3 #534

Merged
merged 48 commits into from
Jan 15, 2024
Merged

Upgrade to Scala 3 #534

merged 48 commits into from
Jan 15, 2024

Conversation

Ragazoor
Copy link
Contributor

@Ragazoor Ragazoor commented Dec 29, 2023

Hello! 馃憢
I really want to use zio-actors for a toy project and thought this could become a good first open source contribution:)

This PR is first and foremost to get zio-actors to build on scala 3. I tried to (almost) only make changes that would make the project compile on Scala 3 and solve issue #308. Below is a summary of the changes I made:

  • Upgraded most libraries to versions that are compatible and support scala 3
  • Removed the dependency on scala-reflect (dropped in Scala 3)
  • Migrated compiler flags for scala 3 (and added flags unique for scala 3)
  • Migrated minor syntax things like imports (._ to .*) and wildcard types [_] to [?]
    • Undid this because +publishLocal stopped working, (zio-http also runs with import foo._)
  • Higher kinded types seems a bit iffy, biggest issue was problems like these 1 and 2.
    • Solved by adding a wrapper to the PendingMessage[F[_],A] type (migration notes)
    • I removed the type parameter needed for akka messages.
      • I didn't see why messages used for AkkaTypedActorRefLocal needed a type parameter, it is not how akka does it, we don't use it and it was hard to make it work on scala 3...
      • Updated akka-interop docs a little with the change.
  • Renamed some things to improve readability (imo). Some names in akka-interop tests, type parameters with the ! / ? methods to make it clearer what is the response vs request type
  • Could not get the ActorSystem or the Context class to compile on all scala versions so I tried to break out common logic as best as I could to a base class which is shared, and the parts with type issues are scala 2/3 specific

Happy new year! 馃帀

Edit: I'm trying to look at the zio-http project but I'm not familiar with this kind of sbt. I will see if I can get it to compile on all platforms (Made it!)

@CLAassistant
Copy link

CLAassistant commented Dec 29, 2023

CLA assistant check
All committers have signed the CLA.

override private[actors] val actorSystemName: String,
override private[actors] val config: Option[String],
private val remoteConfig: Option[RemoteConfig],
private val initActorRefMap: Ref[Map[String, Actor[Any]]],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I see it correctly the only version-specific difference is Actor[Any] vs Actor[?] here. Is Scala 2 not compiling with ? (or _?)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct, I have made a few attempts on scala 2.13 but haven't been able to make it work... Get errors like:

private val initActorRefMap: Ref[Map[String, Actor[_]]], _$2 takes no type parameters, expected: 1
                                                   ^

I have also tried to make scala 3 compile with Actor[Any] but get errors like:

Type argument Any does not have the same kind as its bound [+_$1]

build.sbt Outdated Show resolved Hide resolved
@vigoo vigoo enabled auto-merge (squash) January 15, 2024 20:01
@vigoo vigoo disabled auto-merge January 15, 2024 20:06
@vigoo vigoo merged commit bff7ccf into zio:master Jan 15, 2024
13 checks passed
@Nojipiz
Copy link

Nojipiz commented May 1, 2024

Is this update supposed to be launch soon?

@liushihai
Copy link

When will this update be released?

@Ragazoor
Copy link
Contributor Author

Ragazoor commented Jun 7, 2024

If you are waiting for it I think the best course of action is to go into the zio discord and ask if someone can release it for you since this library is unmaintained. I had to go there to get someone to review my code.

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.

None yet

6 participants