Skip to content

Commit be0d442

Browse files
committed
Use QuoteContext.NestedContext
1 parent 2f1bd68 commit be0d442

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ trait QuotesAndSplices {
101101
// * Provide meaningful names for QuoteContext synthesized by within `${ ... }`
102102
val qctxParamName = NameKinds.UniqueName.fresh(s"qctx${level - 1}_".toTermName)
103103
val qctxParamTpe = topQuoteContext match {
104-
case Some(qctxRef) =>
105-
val reflectTpe = qctxRef.tpe.select(defn.QuoteContextClass.requiredValue("tasty"))
106-
RefinedType(defn.QuoteContextClass.typeRef, "tasty".toTermName, reflectTpe)
104+
case Some(qctxRef) => qctxRef.tpe.select("NestedContext".toTypeName)
107105
case _ => defn.QuoteContextClass.typeRef
108106
}
109107
val qctxParamTpt = untpd.TypedSplice(TypeTree(qctxParamTpe))

library/src/scala/quoted/QuoteContext.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import scala.quoted.show.SyntaxHighlight
1010
*
1111
* @param tasty Typed AST API. Usage: `def f(qctx: QuoteContext) = { import qctx.tasty.{_, given}; ... }`.
1212
*/
13-
class QuoteContext(val tasty: scala.tasty.Reflection) {
13+
class QuoteContext(val tasty: scala.tasty.Reflection) { self =>
14+
15+
// TODO
16+
type NestedContext = QuoteContext { val tasty: self.tasty.type }
1417

1518
def show(expr: Expr[_], syntaxHighlight: SyntaxHighlight): String = {
1619
import tasty.{_, given}

0 commit comments

Comments
 (0)