Skip to content

doc(macros): add missing using QuoteContext #8296

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
merged 1 commit into from
Feb 12, 2020

Conversation

robstoll
Copy link
Contributor

@robstoll robstoll commented Feb 12, 2020

I tried to run the example with scastie: https://scastie.scala-lang.org/9xO9TXZKS8ydfLsSo3ZJ0g
I guess the example is missing the using QuoteContext.
Where do I get this context from initially?

@nicolasstucki
Copy link
Contributor

Each ${ } provides a given QuoteContext within it. Usually it re-provides the QuoteContext that it's surrounding '{ } uses. In particular, in a macro the first QuoteContext is provided within the ${ } which is instantiated by the compiler when expanding the macro. Alternatively, the first QuoteContext can also come from the scala.quoted.staging.run or scala.quoted.staging.withQuoteContext.

@robstoll
Copy link
Contributor Author

Thank you very much for the explanation 🙂 👍

@nicolasstucki nicolasstucki merged commit 06595f7 into scala:master Feb 12, 2020
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