@@ -5,33 +5,6 @@ package object quoted {
5
5
implicit object ExprOps {
6
6
def (x : T ) toExpr[T : Liftable ](given QuoteContext ): Expr [T ] = summon[Liftable [T ]].toExpr(x)
7
7
8
- /** Lifts this sequence of expressions into an expression of a sequence
9
- *
10
- * Transforms a sequence of expression
11
- * `Seq(e1, e2, ...)` where `ei: Expr[T]`
12
- * to an expression equivalent to
13
- * `'{ Seq($e1, $e2, ...) }` typed as an `Expr[Seq[T]]`
14
- *
15
- * Usage:
16
- * ```scala
17
- * '{ List(${List(1, 2, 3).toExprOfSeq}: _*) } // equvalent to '{ List(1, 2, 3) }
18
- * ```
19
- */
20
- def (seq : Seq [Expr [T ]]) toExprOfSeq[T ](given tp : Type [T ], qctx : QuoteContext ): Expr [Seq [T ]] = {
21
- import qctx .tasty ._
22
- Repeated (seq.map(_.unseal).toList, tp.unseal).seal.asInstanceOf [Expr [Seq [T ]]]
23
- }
24
-
25
- /** Lifts this list of expressions into an expression of a list
26
- *
27
- * Transforms a list of expression
28
- * `List(e1, e2, ...)` where `ei: Expr[T]`
29
- * to an expression equivalent to
30
- * `'{ List($e1, $e2, ...) }` typed as an `Expr[List[T]]`
31
- */
32
- def (list : List [Expr [T ]]) toExprOfList[T ](given Type [T ], QuoteContext ): Expr [List [T ]] =
33
- if (list.isEmpty) ' { Nil } else ' { List ($ {list.toExprOfSeq}: _* ) }
34
-
35
8
/** Lifts this sequence of expressions into an expression of a tuple
36
9
*
37
10
* Transforms a sequence of expression
@@ -88,7 +61,7 @@ package object quoted {
88
61
case Seq (' { $x1 : $t1 }, ' { $x2 : $t2 }, ' { $x3 : $t3 }, ' { $x4 : $t4 }, ' { $x5 : $t5 }, ' { $x6 : $t6 }, ' { $x7 : $t7 }, ' { $x8 : $t8 }, ' { $x9 : $t9 }, ' { $x10 : $t10 }, ' { $x11 : $t11 }, ' { $x12 : $t12 }, ' { $x13 : $t13 }, ' { $x14 : $t14 }, ' { $x15 : $t15 }, ' { $x16 : $t16 }, ' { $x17 : $t17 }, ' { $x18 : $t18 }, ' { $x19 : $t19 }, ' { $x20 : $t20 }, ' { $x21 : $t21 }, ' { $x22 : $t22 }) =>
89
62
' { Tuple22 ($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20, $x21, $x22) }
90
63
case _ =>
91
- ' { Tuple .fromIArray(IArray ($ {seq.toExprOfSeq }: _* )) }
64
+ ' { Tuple .fromIArray(IArray ($ {Expr .ofSeq(seq) }: _* )) }
92
65
}
93
66
}
94
67
0 commit comments