diff --git a/compiler/src/dotty/tools/dotc/quoted/reflect/ReflectionCompilerInterface.scala b/compiler/src/dotty/tools/dotc/quoted/reflect/ReflectionCompilerInterface.scala index ebb34f2fb892..1027039787fe 100644 --- a/compiler/src/dotty/tools/dotc/quoted/reflect/ReflectionCompilerInterface.scala +++ b/compiler/src/dotty/tools/dotc/quoted/reflect/ReflectionCompilerInterface.scala @@ -1843,6 +1843,9 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte def Symbol_noSymbol(using Context): Symbol = core.Symbols.NoSymbol + def Symbol_typeRef(self: Symbol)(using Context): TypeRef = self.typeRef + + def Symbol_termRef(self: Symbol)(using Context): TermRef = self.termRef /////////// // FLAGS // diff --git a/library/src-bootstrapped/scala/quoted/util/ExprMap.scala b/library/src-bootstrapped/scala/quoted/util/ExprMap.scala index bc2237c344b2..08d08f8e98b5 100644 --- a/library/src-bootstrapped/scala/quoted/util/ExprMap.scala +++ b/library/src-bootstrapped/scala/quoted/util/ExprMap.scala @@ -64,11 +64,7 @@ trait ExprMap { val tp = tpt.tpe match // TODO improve code case AppliedType(TypeRef(ThisType(TypeRef(NoPrefix(), "scala")), ""), List(tp0: Type)) => - // TODO rewrite without using quotes - type T - val qtp: quoted.Type[T] = tp0.seal.asInstanceOf[quoted.Type[T]] - given qtp.type = qtp - '[Seq[T]].unseal.tpe + Symbol.requiredClass("scala.collection.immutable.Seq").typeRef.appliedTo(tp0) case tp => tp Typed.copy(tree)(transformTerm(expr, tp), transformTypeTree(tpt)) case tree: NamedArg => diff --git a/library/src/scala/internal/tasty/CompilerInterface.scala b/library/src/scala/internal/tasty/CompilerInterface.scala index b3146276b0b2..525b88d9ff86 100644 --- a/library/src/scala/internal/tasty/CompilerInterface.scala +++ b/library/src/scala/internal/tasty/CompilerInterface.scala @@ -997,6 +997,11 @@ trait CompilerInterface extends scala.tasty.reflect.Types { /** Case class or case object children of a sealed trait */ def Symbol_children(self: Symbol)(using ctx: Context): List[Symbol] + /** Type referene to the symbol */ + def Symbol_typeRef(self: Symbol)(using Context): TypeRef + + /** Term referene to the symbol */ + def Symbol_termRef(self: Symbol)(using Context): TermRef /////////// // FLAGS // diff --git a/library/src/scala/tasty/Reflection.scala b/library/src/scala/tasty/Reflection.scala index ba6daf3fa3ca..10fa5b35928e 100644 --- a/library/src/scala/tasty/Reflection.scala +++ b/library/src/scala/tasty/Reflection.scala @@ -2122,6 +2122,14 @@ trait Reflection extends reflect.Types { reflectSelf: CompilerInterface => def companionModule(using ctx: Context): Symbol = reflectSelf.Symbol_companionModule(sym) + /** Type referene to the symbol */ + def typeRef(using Context): TypeRef = + reflectSelf.Symbol_typeRef(sym) + + /** Term referene to the symbol */ + def termRef(using Context): TermRef = + reflectSelf.Symbol_termRef(sym) + /** Shows the tree as extractors */ def showExtractors(using ctx: Context): String = new ExtractorsPrinter[reflectSelf.type](reflectSelf).showSymbol(sym)