-
Notifications
You must be signed in to change notification settings - Fork 130
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
Logging Macro Doesn't Support Scala2 + Scala3 Simultaneously #317
Comments
There hasn't been any discussion activity on this issue in the month since I opened it. Is anyone actively working on this issue who could share the status of it? I am trying to dig into the problem still myself in my spare time, but progress has been slow. |
We are running into the same issue and would like a resolution for this as well |
bishabosha
added a commit
to scala/scala3
that referenced
this issue
Oct 12, 2023
Fixes #16630 This PR fixes the above issue which affects cross scala2/3 projects that use a common macro library as per https://docs.scala-lang.org/scala3/guides/migration/tutorial-macro-mixing.html , e.g. scala-logging is blocked from fixing this issue lightbend-labs/scala-logging#317 The fix makes the scala 2 macro check read the Erased flag from the initial flags rather than completing the RHS first. This will work in the case of scala 2 macros because the erased flag is explicitly added rather than being in the source code. However it relies on using an "UNSAFE" value.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am working in a Scala project that is in the middle of migrating from Scala 2 to Scala 3. We are trying to perform this migration in piecemeal, but the scala-logging library is currently making it difficult to do so.
In theory, there should be a way to implement Scala macros such that both Scala 2 and Scala 3 dependencies can depend on the library and call the macro code (see https://github.com/scalacenter/mix-macros-scala-2-and-3, an example repo put together to demonstrate how to do this). However, when attempting this with the scala-logging library (see Zeimyth/mix-macros-scala-2-and-3#1), the Scala 2 build gets these errors at compile time:
I am not fluent enough in Scala macros (and certainly not in cross-version Scala macro support) to know exactly why the example repo's macro is supported in both Scala versions but the scala-logging one is not. I think it has to do with the way the example repo is defining a single source file that exposes both macros together: https://github.com/scalacenter/mix-macros-scala-2-and-3/blob/develop/testframework/src/main/scala/testframework/package.scala. Perhaps scala-logging needs something like this?
The text was updated successfully, but these errors were encountered: