Skip to content

Commit 78cff1b

Browse files
authored
Fix tupleTypeFromSeq for XXL tuples (#21782)
Fixes #21779
2 parents 8431d84 + af9ee8e commit 78cff1b

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

Diff for: library/src/scala/quoted/Expr.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ object Expr {
256256
private def tupleTypeFromSeq(seq: Seq[Expr[Any]])(using Quotes): quotes.reflect.TypeRepr =
257257
import quotes.reflect.*
258258
val consRef = Symbol.classSymbol("scala.*:").typeRef
259-
seq.foldLeft(TypeRepr.of[EmptyTuple]) { (ts, expr) =>
259+
seq.foldRight(TypeRepr.of[EmptyTuple]) { (expr, ts) =>
260260
AppliedType(consRef, expr.asTerm.tpe :: ts :: Nil)
261261
}
262262

Diff for: tests/pos/i21779/Macro_1.scala

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import scala.quoted.*
2+
3+
object Macro:
4+
transparent inline def tupleXxl: Tuple =
5+
${tupleXxlExpr}
6+
7+
def tupleXxlExpr(using Quotes) =
8+
import quotes.reflect.*
9+
Expr.ofTupleFromSeq(
10+
Seq(
11+
Expr("a"),
12+
Expr(2),
13+
Expr(3),
14+
Expr(4),
15+
Expr(5),
16+
Expr(6),
17+
Expr(7),
18+
Expr(8),
19+
Expr(9),
20+
Expr(10),
21+
Expr(11),
22+
Expr(12),
23+
Expr(13),
24+
Expr(14),
25+
Expr(15),
26+
Expr(16),
27+
Expr(17),
28+
Expr(18),
29+
Expr(19),
30+
Expr(20),
31+
Expr(21),
32+
Expr(22),
33+
Expr(23),
34+
)
35+
)
36+

Diff for: tests/pos/i21779/Test_2.scala

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object Test:
2+
val result: ("a", 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23) =
3+
Macro.tupleXxl

0 commit comments

Comments
 (0)