Skip to content

Handle QuoteContext paths explicitly #8497

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 10, 2020

Provide a stronger invariant internal encoding for splices that depend on outer an outer QuoteContext

Currently we use

def exprSplice[T, QCtx <: QuoteContext](x: QCtx ?=> Expr[T]): T = ???

exprSplice[T, qctx.NestedContext](...)

assuming that QCtx will be a qctx.NestedContext if the splice has an outer context or QuoteContext if it does not. This encoding is quite fragile as QCtx could get widen and lose the path when typing.

Instead, we use the following encoding

def exprSplice[T](x: QuoteContext ?=> Expr[T]): T = ???
def exprNestedSplice[T](ctx: QuoteContext)(x: ctx.NestedContext ?=> Expr[T]): T = ???

exprSplice[T](ctx)(...)
exprNestedSplice[T](ctx)(...)

With this encoding, there is only one option for the type of the context function x.

@nicolasstucki nicolasstucki self-assigned this Mar 10, 2020
@nicolasstucki nicolasstucki force-pushed the handle-quotecontext-paths-explicitly branch 7 times, most recently from c7b8d02 to 600a30b Compare March 16, 2020 11:42
@nicolasstucki nicolasstucki marked this pull request as ready for review March 17, 2020 13:36
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

@nicolasstucki
Copy link
Contributor Author

Let's wait until we check that nightlies are correctly published from GitHub actions.

@nicolasstucki nicolasstucki force-pushed the handle-quotecontext-paths-explicitly branch from 600a30b to 1cb6558 Compare March 20, 2020 08:27
@nicolasstucki
Copy link
Contributor Author

Rebased. No changes.

@nicolasstucki nicolasstucki merged commit e2ef8bc into scala:master Mar 20, 2020
@nicolasstucki nicolasstucki deleted the handle-quotecontext-paths-explicitly branch March 20, 2020 12:58
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