diff --git a/compiler/src/dotty/tools/dotc/quoted/QuoteContext.scala b/compiler/src/dotty/tools/dotc/quoted/QuoteContext.scala index b9e762c7001b..b6b2d269ce67 100644 --- a/compiler/src/dotty/tools/dotc/quoted/QuoteContext.scala +++ b/compiler/src/dotty/tools/dotc/quoted/QuoteContext.scala @@ -6,7 +6,7 @@ import dotty.tools.dotc.tastyreflect.ReflectionImpl object QuoteContext { def apply()(using Context): scala.quoted.QuoteContext = - new scala.quoted.QuoteContext(ReflectionImpl(summon[Context])) + new QuoteContext(ReflectionImpl(summon[Context])) type ScopeId = Int @@ -19,3 +19,5 @@ object QuoteContext { private[dotty] def scopeId(using Context): ScopeId = summon[Context].outersIterator.toList.last.hashCode() } + +class QuoteContext(val tasty: scala.tasty.Reflection) extends scala.quoted.QuoteContext diff --git a/library/src/scala/quoted/QuoteContext.scala b/library/src/scala/quoted/QuoteContext.scala index 957beebbea24..046294257ae4 100644 --- a/library/src/scala/quoted/QuoteContext.scala +++ b/library/src/scala/quoted/QuoteContext.scala @@ -10,7 +10,12 @@ import scala.quoted.show.SyntaxHighlight * * @param tasty Typed AST API. Usage: `def f(qctx: QuoteContext) = { import qctx.tasty._; ... }`. */ -class QuoteContext(val tasty: scala.tasty.Reflection) { self => +trait QuoteContext { self => + + /** Low-level Typed AST API `tasty` meta-programming API. + * This API does not have the static type guarantiees that `Expr` and `Type` provide. + */ + val tasty: scala.tasty.Reflection /** Type of a QuoteContext provided by a splice within a quote that took this context. * It is only required if working with the reflection API.