Skip to content
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

Only transform the body of the quote with QuoteTransformer #17451

Merged
merged 1 commit into from
May 10, 2023

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki marked this pull request as ready for review May 10, 2023 11:55
QuoteTransformer().transform(tree)
case tree: Quote =>
val body1 = QuoteTransformer().transform(tree.body)(using quoteContext)
cpy.Quote(tree)(body = body1)
case tree: DefDef if tree.symbol.is(Inline) =>
// Quotes in inlined methods are only pickled after they are inlined.
Copy link
Member

Choose a reason for hiding this comment

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

What happens if I have a quote in an inline def in a class in a quote? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume you mean something like

'{
  class Foo:
    inline def f = '{ ... }
}

In that case the inline def should be rejected when typing. I will check that this is correctly handled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We fail correctly with

5 |    inline def f(using Quotes) = '{ 1 }
  |               ^
  |               inline def cannot be within 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.

@nicolasstucki nicolasstucki merged commit 82efd33 into scala:main May 10, 2023
@nicolasstucki nicolasstucki deleted the clenup-Splicing branch May 10, 2023 15:52
This pull request was closed.
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