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

Scala 3 support #109

Merged
merged 5 commits into from
Oct 25, 2021
Merged

Scala 3 support #109

merged 5 commits into from
Oct 25, 2021

Conversation

arixmkii
Copy link
Contributor

Fixes #107

I bumped some (probably too many) libraries, what looked reasonable to do. I also applied some Scala3 options, which I used in other projects, but I'm not saying that it is perfect and could be changed if needed.

Also replaced silencer with a combination of @nowarn + compiler setting for Scala213 to silence no-suppress.

Removed Numeric Semigroup as it looked unused I didn't want to write Scala3 version of it.

Changed recursive setToTime in gauge to implementation used by gauge child, because Scala3 was blaming the code for infinite recursion and I could not understand the reason why it was written this way.

Had to create Scala3 specific version of Show, because otherwise it failed to discover needed implicits. Now it is a bit ugly because Scala212 and Scala213 are just the same code copied.

Adjusted ci matrix to what looks like logical change, but I have no idea if this really works.

DropwizardExtractor Scala3 version is a copy of Scala213 with minor fix for Type discovery collision under the new compiler.

There is also an ugly hack around scala binary version detection as it doesn't seem to work for Scala3, so, first we check scala version and then scala binary version.

@CLAassistant
Copy link

CLAassistant commented Oct 23, 2021

CLA assistant check
All committers have signed the CLA.

@arixmkii
Copy link
Contributor Author

Addressed some of the issues listed in the description in cleanup commits.

@toxicafunk
Copy link
Member

Can your run sbt fmt check and submit if no errors?

Thanks

@arixmkii
Copy link
Contributor Author

Added formatting fixes. Didn't pay attention to empty lines in the original changeset.

@toxicafunk
Copy link
Member

toxicafunk commented Oct 25, 2021

The build for Scala 3 complains that:

[error] 8 is not a valid choice for -release

So on build.sbt:
case Some((3, _)) => Seq("-release:8")

@arixmkii
Copy link
Contributor Author

Reproduced the error with scalac and jdk 1.8. Looks like an issue how scalac uses release flag. We can drop it temporary and rely on the default behavior for now (which should be Java 8 level, but better to double check).

@arixmkii
Copy link
Contributor Author

Reported in dotty issues scala/scala3#13810

@arixmkii
Copy link
Contributor Author

@toxicafunk we have some options:

  1. command line/env var flag to sbt to ignore/remove it
  2. write some code to check the host JDK in sbt and then decide on the options
  3. just remove it
  4. wait for the fix in scalac (not going to be fast)

I will experiment with 2. for the moment.

@toxicafunk
Copy link
Member

Remove it and push it so I can merge it. Then I can maybe help with 1 or 2 until something happens on 4.

Thanks

@toxicafunk toxicafunk merged commit 56a4a16 into zio:master Oct 25, 2021
scalacOptions ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) =>
Seq() // Seq("-release:8") has issue running with JDK8 https://github.com/lampepfl/dotty/issues/13810

Choose a reason for hiding this comment

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

Scala 3 still supports -Xtarget 8, which should work with any JDK. It's an equivalent of Scala 2' -target jvm-1.8 and both these options make the compiler produce bytecode for JDK 8. The difference is that only -release checks whether you don't use any elements of JDK's API that are absent from the specified version

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.

Scala 3 support
4 participants