Skip to content

Change signature of quoted.Type encoding #11608

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

@nicolasstucki nicolasstucki commented Mar 5, 2021

This avoids unnecessary closures in the generated code.

It will also help with meta-metaprogramming such as writing typeclass derivation for ToExpr.

Also updated internal documentation.

@nicolasstucki nicolasstucki self-assigned this Mar 5, 2021
@nicolasstucki nicolasstucki force-pushed the change-Type-encoding-signature branch 3 times, most recently from 0e07132 to 9366710 Compare March 5, 2021 10:49
@nicolasstucki nicolasstucki force-pushed the change-Type-encoding-signature branch from 9366710 to 9f1f1ef Compare March 5, 2021 12:17
@nicolasstucki nicolasstucki requested a review from liufengyun March 5, 2021 15:25
@nicolasstucki nicolasstucki marked this pull request as ready for review March 5, 2021 15:25
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

body.tpe match
case tp @ TypeRef(x: TermRef, _) if tp.symbol == defn.QuotedType_splice =>
// Optimization: `quoted.Type.of[x.Underlying](quotes)` --> `x`
ref(x)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here the body is not inspected. Is it possible that the body contains trees other than quoted.Type.of[x.Underlying](quotes)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. This tree is generated on the QuotesAndSpliced typing class and its shape is kept as is. If We get something else it would be considered a bug and it would probably break more than this.

@nicolasstucki nicolasstucki merged commit 50db81d into scala:master Mar 8, 2021
@nicolasstucki nicolasstucki deleted the change-Type-encoding-signature branch March 8, 2021 08:34
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

3 participants