Skip to content

Commit 5c6098f

Browse files
Merge pull request #8438 from dotty-staging/simplify-import-of-tasty-rootContext
Simplify import of qctx.tasty.rootContext
2 parents 66220a3 + b302842 commit 5c6098f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

library/src/scala/tasty/Reflection.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
440440
//////////////
441441

442442
/** Context of the macro expansion */
443-
given rootContext as Context = internal.rootContext // TODO: Use given // TODO: Should this be moved to QuoteContext?
443+
def rootContext: Context = internal.rootContext // TODO: Should this be moved to QuoteContext?
444+
given Context = rootContext // TODO: Should be an implicit converion from QuoteContext to Context
444445

445446
extension ContextOps on (self: Context) {
446447
/** Returns the owner of the context */

tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object SourceFiles {
1111

1212
def getThisFileImpl: Macro[String] = {
1313
val qctx = tastyContext
14-
import qctx.tasty.{_, given _}
14+
import qctx.tasty._
1515
rootContext.source.getFileName.toString
1616
}
1717

tests/run-macros/tasty-getfile/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ object SourceFiles {
88
${getThisFileImpl}
99

1010
private def getThisFileImpl(using qctx: QuoteContext) : Expr[String] = {
11-
import qctx.tasty.{_, given _}
12-
rootContext.source.getFileName.toString
11+
import qctx.tasty._
12+
summon[Context].source.getFileName.toString
1313
}
1414

1515
}

0 commit comments

Comments
 (0)