diff --git a/library/src-scala3/scala/quoted/package.scala b/library/src-scala3/scala/quoted/package.scala new file mode 100644 index 000000000000..f7ece4905368 --- /dev/null +++ b/library/src-scala3/scala/quoted/package.scala @@ -0,0 +1,18 @@ +package scala + +package object quoted { + + implicit class LiftExprOps[T](val x: T) extends AnyVal { + def toExpr(implicit ev: Liftable[T]): Expr[T] = ev.toExpr(x) + } + + implicit class ListOfExprOps[T](val list: List[Expr[T]]) extends AnyVal { + def toExprOfList(implicit ev: Type[T]): Expr[List[T]] = { + def rec(list: List[Expr[T]]): Expr[List[T]] = list match { + case x :: xs => '{ (~x) :: (~rec(xs)) } + case Nil => '(Nil) + } + rec(list) + } + } +} diff --git a/library/src/scala/quoted/package.scala b/library/src/scala/quoted/package.scala deleted file mode 100644 index 3a1be2f5f5e1..000000000000 --- a/library/src/scala/quoted/package.scala +++ /dev/null @@ -1,9 +0,0 @@ -package scala - -package object quoted { - - implicit class LiftExprOps[T](val x: T) extends AnyVal { - def toExpr(implicit ev: Liftable[T]): Expr[T] = ev.toExpr(x) - } - -} diff --git a/tests/run-separate-compilation/xml-interpolation-2/XmlQuote_1.scala b/tests/run-separate-compilation/xml-interpolation-2/XmlQuote_1.scala index e9f479739f99..39e51aa50ddf 100644 --- a/tests/run-separate-compilation/xml-interpolation-2/XmlQuote_1.scala +++ b/tests/run-separate-compilation/xml-interpolation-2/XmlQuote_1.scala @@ -56,11 +56,7 @@ object XmlQuote { // [a0, ...]: Any* val args2: Expr[List[Any]] = args.unseal.underlyingArgument match { case Typed(Repeated(args0), _) => // statically known args, make list directly - def liftListOfAny(lst: List[Expr[Any]]): Expr[List[Any]] = lst match { - case x :: xs => '{ ~x :: ~liftListOfAny(xs) } - case Nil => '(Nil) - } - liftListOfAny(args0.map(_.seal[Any])) + args0.map(_.seal[Any]).toExprOfList case _ => '((~args).toList)