File tree 2 files changed +10
-8
lines changed
src-non-bootstrapped/scala/quoted 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -10,5 +10,11 @@ package object quoted {
10
10
11
11
implicit object ExprOps {
12
12
def (x : T ) toExpr[T : Liftable ] given QuoteContext : Expr [T ] = the[Liftable [T ]].toExpr(x)
13
+
14
+ def (seq : Seq [Expr [T ]]) toExprOfSeq[T ] given (tp : Type [T ], qctx : QuoteContext ): Expr [Seq [T ]] =
15
+ throw new Exception (" Non bootsrapped library" )
16
+
17
+ def (list : List [Expr [T ]]) toExprOfList[T ] given Type [T ], QuoteContext : Expr [List [T ]] =
18
+ throw new Exception (" Non bootsrapped library" )
13
19
}
14
20
}
Original file line number Diff line number Diff line change @@ -53,17 +53,13 @@ object Liftable {
53
53
}
54
54
55
55
given [T : Type : Liftable ] as Liftable [Seq [T ]] = new Liftable [Seq [T ]] {
56
- def toExpr (seq : Seq [T ]): given QuoteContext => Expr [Seq [T ]] = given qctx => {
57
- import qctx .tasty ._
58
- Repeated (seq.map(x => the[Liftable [T ]].toExpr(x).unseal).toList, the[quoted.Type [T ]].unseal).seal.asInstanceOf [Expr [Seq [T ]]]
59
- }
56
+ def toExpr (xs : Seq [T ]): given QuoteContext => Expr [Seq [T ]] =
57
+ xs.map(the[Liftable [T ]].toExpr).toExprOfSeq
60
58
}
61
59
62
60
given [T : Type : Liftable ] as Liftable [List [T ]] = new Liftable [List [T ]] {
63
- def toExpr (x : List [T ]): given QuoteContext => Expr [List [T ]] = x match {
64
- case x :: xs => ' { ($ {xs.toExpr}).:: [T ]($ {x.toExpr}) }
65
- case Nil => ' { Nil : List [T ] }
66
- }
61
+ def toExpr (xs : List [T ]): given QuoteContext => Expr [List [T ]] =
62
+ xs.map(the[Liftable [T ]].toExpr).toExprOfList
67
63
}
68
64
69
65
given [T : Type : Liftable ] as Liftable [Set [T ]] = new Liftable [Set [T ]] {
You can’t perform that action at this time.
0 commit comments