Skip to content

Commit 86d5d69

Browse files
Merge pull request #8191 from dotty-staging/add-missing-contexts
Add missing contexts and remove unnecessary given arguments
2 parents 96036af + ce3171c commit 86d5d69

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

library/src/scala/quoted/QuoteContext.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ class QuoteContext(val tasty: scala.tasty.Reflection) {
2525
/** Report an error at the position of the macro expansion */
2626
def error(msg: => String): Unit = {
2727
import tasty.{_, given}
28-
tasty.error(msg, rootPosition)(given rootContext)
28+
tasty.error(msg, rootPosition)
2929
}
3030

3131
/** Report an error at the on the position of `expr` */
32-
def error(msg: => String, expr: Expr[_]): Unit = {
32+
def error(msg: => String, expr: Expr[Any]): Unit = {
3333
import tasty.{_, given}
34-
tasty.error(msg, expr.unseal.pos)(given rootContext)
34+
tasty.error(msg, expr.unseal.pos)
3535
}
3636

3737
/** Report an error at the position of the macro expansion and throws a StopQuotedContext */
@@ -40,21 +40,21 @@ class QuoteContext(val tasty: scala.tasty.Reflection) {
4040
throw new StopQuotedContext
4141
}
4242
/** Report an error at the on the position of `expr` and throws a StopQuotedContext */
43-
def throwError(msg: => String, expr: Expr[_]): Nothing = {
43+
def throwError(msg: => String, expr: Expr[Any]): Nothing = {
4444
error(msg, expr)
4545
throw new StopQuotedContext
4646
}
4747

4848
/** Report a warning */
4949
def warning(msg: => String): Unit = {
5050
import tasty.{_, given}
51-
tasty.warning(msg, rootPosition)(given rootContext)
51+
tasty.warning(msg, rootPosition)
5252
}
5353

5454
/** Report a warning at the on the position of `expr` */
5555
def warning(msg: => String, expr: Expr[_]): Unit = {
5656
import tasty.{_, given}
57-
tasty.warning(msg, expr.unseal.pos)(given rootContext)
57+
tasty.warning(msg, expr.unseal.pos)
5858
}
5959

6060
}

library/src/scala/tasty/Reflection.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
15931593
///////////////
15941594

15951595
/** Returns the type (Type) of T */
1596-
def typeOf[T](given qtype: scala.quoted.Type[T]): Type = qtype.unseal.tpe
1596+
def typeOf[T](given qtype: scala.quoted.Type[T], ctx: Context): Type = qtype.unseal.tpe
15971597

15981598
/** Members of `TypeOrBounds` */
15991599
extension TypeOrBoundsOps on (tpe: TypeOrBounds) {
@@ -2990,7 +2990,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
29902990
}
29912991

29922992
/** Bind the `rhs` to a `val` and use it in `body` */
2993-
def let(rhs: Term)(body: Ident => Term): Term = {
2993+
def let(rhs: Term)(body: Ident => Term)(given ctx: Context): Term = {
29942994
import scala.quoted.QuoteContext
29952995
given QuoteContext = new QuoteContext(this)
29962996
val expr = (rhs.seal: @unchecked) match {
@@ -3007,7 +3007,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
30073007
}
30083008

30093009
/** Bind the given `terms` to names and use them in the `body` */
3010-
def lets(terms: List[Term])(body: List[Term] => Term): Term = {
3010+
def lets(terms: List[Term])(body: List[Term] => Term)(given Context): Term = {
30113011
def rec(xs: List[Term], acc: List[Term]): Term = xs match {
30123012
case Nil => body(acc)
30133013
case x :: xs => let(x) { (x: Term) => rec(xs, x :: acc) }

0 commit comments

Comments
 (0)