Skip to content

Commit 5f6837a

Browse files
authored
Merge pull request #8939 from dotty-staging/add-qctx
Add scala.quoted.qctx
2 parents f511fb2 + c0d32b2 commit 5f6837a

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package scala.quoted
2+
3+
/** Current QuoteContext in scope */
4+
def qctx(using qctx: QuoteContext): qctx.type = qctx

tests/run-macros/reflect-select-value-class/assert_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object scalatest {
44

55
inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) }
66

7-
def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = {
7+
def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using QuoteContext) : Expr[Unit] = {
88
import qctx.tasty._
99
import util._
1010

tests/run-macros/tasty-linenumber-2/quoted_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object LineNumber {
99

1010
implicit inline def line: LineNumber = ${lineImpl}
1111

12-
def lineImpl(using qctx: QuoteContext) : Expr[LineNumber] = {
12+
def lineImpl(using QuoteContext) : Expr[LineNumber] = {
1313
import qctx.tasty._
1414
'{new LineNumber(${rootPosition.startLine})}
1515
}

tests/run-macros/tasty-linenumber/quoted_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object LineNumber {
1010
implicit inline def line[T >: Unit <: Unit]: LineNumber =
1111
${lineImpl('[T])}
1212

13-
def lineImpl(x: Type[Unit])(using qctx: QuoteContext) : Expr[LineNumber] = {
13+
def lineImpl(x: Type[Unit])(using QuoteContext) : Expr[LineNumber] = {
1414
import qctx.tasty._
1515
'{new LineNumber(${rootPosition.startLine})}
1616
}

tests/run-macros/tasty-subtyping/quoted_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ object Macros {
99
inline def isSubTypeOf[T, U]: Boolean =
1010
${isSubTypeOfImpl('[T], '[U])}
1111

12-
def isTypeEqualImpl[T, U](t: Type[T], u: Type[U])(using qctx: QuoteContext) : Expr[Boolean] = {
12+
def isTypeEqualImpl[T, U](t: Type[T], u: Type[U])(using QuoteContext) : Expr[Boolean] = {
1313
import qctx.tasty._
1414
val isTypeEqual = t.unseal.tpe =:= u.unseal.tpe
1515
isTypeEqual
1616
}
1717

18-
def isSubTypeOfImpl[T, U](t: Type[T], u: Type[U])(using qctx: QuoteContext) : Expr[Boolean] = {
18+
def isSubTypeOfImpl[T, U](t: Type[T], u: Type[U])(using QuoteContext) : Expr[Boolean] = {
1919
import qctx.tasty._
2020
val isTypeEqual = t.unseal.tpe <:< u.unseal.tpe
2121
isTypeEqual

tests/run-staging/staged-tuples/StagedTuple.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ object StagedTuple {
126126
}
127127

128128
def applyStaged[Tup <: NonEmptyTuple : Type, N <: Int : Type](tup: Expr[Tup], size: Option[Int], n: Expr[N], nValue: Option[Int])(using qctx: QuoteContext): Expr[Elem[Tup, N]] = {
129-
import reflect._
130129

131130
if (!specialize) '{dynamicApply($tup, $n)}
132131
else {

0 commit comments

Comments
 (0)