-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Simplify import of qctx.tasty.rootContext #8438
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
Simplify import of qctx.tasty.rootContext #8438
Conversation
Allow `rootContext` with `import qctx.tasty._` (no given import)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, LGTM
@@ -452,7 +452,8 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => | |||
////////////// | |||
|
|||
/** Context of the macro expansion */ | |||
given rootContext as Context = internal.rootContext // TODO: Use given // TODO: Should this be moved to QuoteContext? | |||
def rootContext: Context = internal.rootContext // TODO: Should this be moved to QuoteContext? | |||
given Context = rootContext // TODO: Should be an implicit converion from QuoteContext to Context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems not useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is to be able to access the rootContext
by name when only importing import qctx.tasty._
, otherwise it is only visible with the given import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing changed for summoning it
@@ -11,7 +11,7 @@ object SourceFiles { | |||
|
|||
def getThisFileImpl: Macro[String] = { | |||
val qctx = tastyContext | |||
import qctx.tasty.{_, given _} | |||
import qctx.tasty._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have many such cases in the test set, change them too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to adapt unseal to be able to change them all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #8441
Allow
rootContext
withimport qctx.tasty._
(no given import)This takes advantage of the change introduced in #8410