diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala index a00707c048f2..e6a5d9a6a84d 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala @@ -10,13 +10,13 @@ object ReflectionImpl { apply(rootContext, SourcePosition(rootContext.source, Spans.NoSpan)) def apply(rootContext: Contexts.Context, rootPosition: SourcePosition): scala.tasty.Reflection = - new ReflectionImpl(new KernelImpl(rootContext, rootPosition)) + new scala.tasty.Reflection(new KernelImpl(rootContext, rootPosition)) def showTree(tree: tpd.Tree)(implicit ctx: Contexts.Context): String = { - val refl = new ReflectionImpl(new KernelImpl(ctx, tree.sourcePos)) - new refl.SourceCodePrinter().showTree(tree) + val refl = new scala.tasty.Reflection(new KernelImpl(ctx, tree.sourcePos)) + val reflCtx = ctx.asInstanceOf[refl.Context] + val reflTree = tree.asInstanceOf[refl.Tree] + new refl.SourceCodePrinter().showTree(reflTree)(reflCtx) } - private class ReflectionImpl(val kernel: KernelImpl) extends scala.tasty.Reflection - } diff --git a/library/src/scala/tasty/Reflection.scala b/library/src/scala/tasty/Reflection.scala index 61ad3db52d3e..c50947a657fb 100644 --- a/library/src/scala/tasty/Reflection.scala +++ b/library/src/scala/tasty/Reflection.scala @@ -2,7 +2,7 @@ package scala.tasty import scala.tasty.reflect._ -abstract class Reflection +class Reflection(val kernel: Kernel) extends Core with ConstantOps with ContextOps