Skip to content

Commit 32400b2

Browse files
Merge pull request #6947 from dotty-staging/add-liftable-tuplexxl
Add `quoted.Liftable[TupleN]` with N > 22 to the stdlib
2 parents bc81953 + c544c17 commit 32400b2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

library/src/scala/quoted/Liftable.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ object Liftable {
239239
}
240240
}
241241

242+
given [H: Type: Liftable, T <: Tuple: Type: Liftable] as Liftable[H *: T] = new {
243+
def toExpr(tup: H *: T): given QuoteContext => Expr[H *: T] =
244+
'{ ${tup.head.toExpr} *: ${tup.tail.toExpr} }
245+
}
246+
242247
given as Liftable[BigInt] = new Liftable[BigInt] {
243248
def toExpr(x: BigInt): given QuoteContext => Expr[BigInt] =
244249
'{ BigInt(${x.toByteArray.toExpr}) }

tests/run-with-compiler/quote-lib.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ object Test {
4343
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20).toExpr
4444
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21).toExpr
4545
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22).toExpr
46-
// (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23).toExpr
47-
// (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24).toExpr
48-
// (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25).toExpr
46+
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23).toExpr
47+
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24).toExpr
48+
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25).toExpr
4949

5050
val list: List[Int] = List(1, 2, 3)
5151
val liftedList: Expr[List[Int]] = list

0 commit comments

Comments
 (0)