-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Reimplement Macros with Scala 3 metaprogramming #689
Conversation
4f31838
to
63913dc
Compare
docs/manual/working/scalaGuide/main/json/code/ScalaJsonAutomatedSpec.scala
Outdated
Show resolved
Hide resolved
docs/manual/working/scalaGuide/main/json/code/ScalaJsonCombinatorsSpec.scala
Outdated
Show resolved
Hide resolved
docs/manual/working/scalaGuide/main/json/code/ScalaJsonSpec.scala
Outdated
Show resolved
Hide resolved
play-functional/src/main/scala/play/api/libs/functional/Alternative.scala
Outdated
Show resolved
Hide resolved
play-functional/src/main/scala/play/api/libs/functional/Applicative.scala
Outdated
Show resolved
Hide resolved
@@ -139,7 +139,7 @@ private[json] trait JsValueMacros { | |||
|
|||
} | |||
|
|||
trait JsMacrosWithOptions extends JsMacros { | |||
trait JsMacrosWithOptions[Opts <: Json.MacroOptions] extends JsMacros { |
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.
Required for the Scala3 equivalent, not a compatibility issue for me, as compile-time
@@ -12,179 +12,8 @@ import org.scalacheck.Gen | |||
class MacroScala2Spec extends AnyWordSpec with Matchers with org.scalatestplus.scalacheck.ScalaCheckPropertyChecks { | |||
import MacroScala2Spec._ | |||
|
|||
"Reads" should { |
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.
Merge back to MacroSpec
@@ -33,36 +33,34 @@ class JsonSharedSpec extends AnyWordSpec with Matchers with org.scalatestplus.sc | |||
"JSON" should { | |||
"equals JsObject independently of field order" in json { js => | |||
js.obj( | |||
"field1" -> 123, |
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.
Source formatting
@@ -9,6 +9,7 @@ import Matchers._ | |||
import org.scalatest.wordspec.AnyWordSpec | |||
|
|||
object TestFormats { | |||
|
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.
Source formatting + restore common specs for Scala 2/3
project/Common.scala
Outdated
@@ -11,11 +11,11 @@ object Common extends AutoPlugin { | |||
|
|||
override def globalSettings = | |||
Seq( | |||
organization := "com.typesafe.play", |
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.
Source formatting
8ff60d8
to
03b2c25
Compare
.scalafmt.conf
Outdated
} | ||
|
||
project.excludePaths = [ | ||
"glob:**/docs/**/code*/*.scala" |
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.
Make sure special comment to extract snipped are unchanged (special comment a doc delimiters)
} | ||
|
||
"no custom ProductOf" in { | ||
"Macros.writer[CustomNoProductOf]".mustNot(typeCheck) |
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.
Conversion
alone is not sufficient
Are there any plans to consider merging this anytime soon? @playframework/contributors |
Just for transparency here, we asked that Cédric split up the PR. Separating the large amount of formatting changes from the relevant code makes it easier to review. |
Up |
Please fix the conflicts ,thanks! |
Approval required |
Thanks for pushing this forward @cchantep After this is merged (hopefully soon!), when can we expect a new release? I've been working off of the 2.10.0-RC5 release in a Scala 3 project; it's 100+ commits behind |
OK, I am going to merge this and release 2.10.0-RC6 so people can start testing |
It would have been nice that I was able to merge it myself (as core contributor for "quite sometime") ... |
You can do now. |
Pull Request Checklist
Purpose
Reimplement Macros with Scala 3 metaprogramming.
ProductOf
/Conversion
)Background Context
First, supports same compile-time features as those provided by the Scala 2 macros.
Simple Dotty derivation not sufficient, use new meta-programming to wrap/adapt (mirror still used to resolve the class fields).
References
Are there any relevant issues / PRs / mailing lists discussions?