Skip to content

Commit 9b9c9f8

Browse files
committed
Implement Reflection API directly
Revert to the original design with abstract modules that are implemented directly. We had to move the implementations to the compiler interface with one of the iterations of extension methods. The current extension methods are again compatible with this design. CompilerInterface is kept for the internal methods that are only available in the stdlib. * Now Reflection contains the full user-facing API * CompilerInterface only contains internal methods used in the stdlib * tasty.refelct.Types was merged into Reflection * QuoteContextImpl implements every member directly * All members of tasty are lazily initialized using object * Fix defn.NullClass * Fix typo in Flags.Accessor * Rename Scala2X to Scala2x to follow dotty conventions
1 parent af1b4a0 commit 9b9c9f8

File tree

11 files changed

+4512
-4987
lines changed

11 files changed

+4512
-4987
lines changed

compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala

Lines changed: 2610 additions & 3 deletions
Large diffs are not rendered by default.

compiler/src/dotty/tools/dotc/quoted/reflect/ReflectionCompilerInterface.scala

Lines changed: 0 additions & 2115 deletions
This file was deleted.

compiler/src/dotty/tools/dotc/transform/TailRec.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ class TailRec extends MiniPhase {
186186
def tailArgOrPureExpr(stat: Tree): Boolean = stat match {
187187
case stat: ValDef if stat.name.is(TailTempName) || !stat.symbol.is(Mutable) => tailArgOrPureExpr(stat.rhs)
188188
case Assign(lhs: Ident, rhs) if lhs.symbol.name.is(TailLocalName) => tailArgOrPureExpr(rhs)
189+
case Assign(lhs: Ident, rhs: Ident) if lhs.symbol == rhs.symbol => true
189190
case stat: Ident if stat.symbol.name.is(TailLocalName) => true
190191
case _ => tpd.isPureExpr(stat)
191192
}

library/src-bootstrapped/scala/quoted/Liftable.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ object Liftable {
5959
/** Default liftable for Class[T] */
6060
given ClassLiftable[T] as Liftable[Class[T]] = new Liftable[Class[T]] {
6161
def toExpr(x: Class[T]) = {
62-
val qctx1 = scala.internal.tasty.CompilerInterface.quoteContextWithCompilerInterface(qctx)
63-
import qctx1.tasty._
64-
val tpe = qctx1.tasty.Type_ofErasedClass(x)
65-
Ref(defn.Predef_classOf).appliedToType(tpe).seal.asInstanceOf[Expr[Class[T]]]
62+
import qctx.tasty._
63+
Ref(defn.Predef_classOf).appliedToType(Type.typeConstructorOf(x)).seal.asInstanceOf[Expr[Class[T]]]
6664
}
6765
}
6866

0 commit comments

Comments
 (0)