lloydmeta / enumeratum

A type-safe, reflection-free, powerful enumeration implementation for Scala with exhaustive pattern match warnings and helpful integrations.
MIT License
1.18k stars 146 forks source link

Mix scala 2 and 3 macros #395

Open gregghz opened 1 month ago

gregghz commented 1 month ago

This follows the pattern shown here: https://docs.scala-lang.org/scala3/guides/migration/tutorial-macro-mixing.html#:~:text=Introduction,during%20the%20macro%20expansion%20phase

This would allow a mixed scala version project to depend on the scala 3 version of enumeratum and build correctly for both scala 2 modules and scala 3 modules. This is particularly helpful when building with bazel since you can't conditionally include a dependency based on the current scala version the same way you would in sbt.

This was brought up previously by @coreywoodfield here: https://github.com/lloydmeta/enumeratum/issues/300#issuecomment-1363451865 (and he is the author of this PR -- I just rebased the branch).

lloydmeta commented 1 month ago

Thanks for the PR but can you please add a description for this that explains why we want this?

gregghz commented 1 month ago

@lloydmeta ah, thanks for taking a look. I've updated the description to clarify what's going on.