Skip to content

Add portotype for Expr[Mirror] methods #18072

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

Merged

Conversation

nicolasstucki
Copy link
Contributor

Getting the info from the mirror in a macro is a bit tricky and verbose. The methods in this portotype intend to make this process trivial.

private def myMacroExpr[T: Type](mirror: Expr[Mirror.Of[T]])(using Quotes): Expr[Any] =
  import MirroredExpr.* // TODO where we could define this?
  val mirroredLabel: Option[String] = mirror.mirroredLabel
  val mirroredElemLabels: Option[List[String]] = mirror.mirroredElemLabels
  val mirroredMonoType: Option[Type[?]] = mirror.mirroredMonoType
  val mirroredType: Option[Type[?]] = mirror.mirroredType
  val mirroredElemTypes: Option[List[Type[?]]] = mirror.mirroredElemTypes
  ...

[skip community_build]
[skip docs]
[skip mima]

Getting the info from the mirror in a macro is a bit tricky and verbose.
The methods in this portotype intend to make this process trivial.
@nicolasstucki nicolasstucki marked this pull request as ready for review June 27, 2023 11:50
@nicolasstucki nicolasstucki requested a review from bishabosha June 27, 2023 11:50
@nicolasstucki nicolasstucki enabled auto-merge June 27, 2023 11:51
@nicolasstucki nicolasstucki merged commit 6acaf95 into scala:main Jun 27, 2023
@nicolasstucki nicolasstucki deleted the mirror-expr-library-portotype branch June 27, 2023 13:36
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.

2 participants