File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
library/src-scala3/scala/quoted
tests/run-separate-compilation/xml-interpolation-2 Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,13 @@ package object quoted {
6
6
def toExpr (implicit ev : Liftable [T ]): Expr [T ] = ev.toExpr(x)
7
7
}
8
8
9
+ implicit class ListOfExprOps [T ](val list : List [Expr [T ]]) extends AnyVal {
10
+ def toExprOfList (implicit ev : Type [T ]): Expr [List [T ]] = {
11
+ def rec (list : List [Expr [T ]]): Expr [List [T ]] = list match {
12
+ case x :: xs => ' { (~ x) :: (~ rec(xs)) }
13
+ case Nil => '(Nil)
14
+ }
15
+ rec(list)
16
+ }
17
+ }
9
18
}
Original file line number Diff line number Diff line change @@ -56,11 +56,7 @@ object XmlQuote {
56
56
// [a0, ...]: Any*
57
57
val args2 : Expr [List [Any ]] = args.unseal.underlyingArgument match {
58
58
case Typed (Repeated (args0), _) => // statically known args, make list directly
59
- def liftListOfAny (lst : List [Expr [Any ]]): Expr [List [Any ]] = lst match {
60
- case x :: xs => ' { ~ x :: ~ liftListOfAny(xs) }
61
- case Nil => '(Nil)
62
- }
63
- liftListOfAny(args0.map(_.seal[Any ]))
59
+ args0.map(_.seal[Any ]).toExprOfList
64
60
case _ =>
65
61
'((~args).toList)
66
62
You can’t perform that action at this time.
0 commit comments