Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tupleTypeFromSeq for XXL tuples #21782

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/src/scala/quoted/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ object Expr {
private def tupleTypeFromSeq(seq: Seq[Expr[Any]])(using Quotes): quotes.reflect.TypeRepr =
import quotes.reflect.*
val consRef = Symbol.classSymbol("scala.*:").typeRef
seq.foldLeft(TypeRepr.of[EmptyTuple]) { (ts, expr) =>
seq.foldRight(TypeRepr.of[EmptyTuple]) { (expr, ts) =>
AppliedType(consRef, expr.asTerm.tpe :: ts :: Nil)
}

Expand Down
36 changes: 36 additions & 0 deletions tests/pos/i21779/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import scala.quoted.*

object Macro:
transparent inline def tupleXxl: Tuple =
${tupleXxlExpr}

def tupleXxlExpr(using Quotes) =
import quotes.reflect.*
Expr.ofTupleFromSeq(
Seq(
Expr("a"),
Expr(2),
Expr(3),
Expr(4),
Expr(5),
Expr(6),
Expr(7),
Expr(8),
Expr(9),
Expr(10),
Expr(11),
Expr(12),
Expr(13),
Expr(14),
Expr(15),
Expr(16),
Expr(17),
Expr(18),
Expr(19),
Expr(20),
Expr(21),
Expr(22),
Expr(23),
)
)

3 changes: 3 additions & 0 deletions tests/pos/i21779/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Test:
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) =
Macro.tupleXxl
Loading