File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
src-non-bootstrapped/scala/quoted Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ package object quoted {
99 throw new Exception (" Non bootsrapped library" )
1010
1111 implicit object ExprOps {
12- def (x : T ) toExpr[T : Liftable ] given QuoteContext : Expr [T ] = the[Liftable [T ]].toExpr(x)
12+ def (x : T ) toExpr[T : Liftable ] given QuoteContext : Expr [T ] =
13+ throw new Exception (" Non bootsrapped library" )
14+
15+ def (seq : Seq [Expr [T ]]) toExprOfSeq[T ] given (tp : Type [T ], qctx : QuoteContext ): Expr [Seq [T ]] =
16+ throw new Exception (" Non bootsrapped library" )
17+
18+ def (list : List [Expr [T ]]) toExprOfList[T ] given Type [T ], QuoteContext : Expr [List [T ]] =
19+ throw new Exception (" Non bootsrapped library" )
1320 }
1421}
Original file line number Diff line number Diff line change @@ -53,17 +53,13 @@ object Liftable {
5353 }
5454
5555 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
6058 }
6159
6260 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
6763 }
6864
6965 given [T : Type : Liftable ] as Liftable [Set [T ]] = new Liftable [Set [T ]] {
You can’t perform that action at this time.
0 commit comments