Skip to content

Fix #7580: Desugar TupleXXL selection into apply(n) #7583

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

Merged
merged 2 commits into from
Nov 19, 2019
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
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,10 @@ object desugar {
val firstDef =
ValDef(tmpName, TypeTree(), matchExpr)
.withSpan(pat.span.union(rhs.span)).withMods(patMods)
def selector(n: Int) = Select(Ident(tmpName), nme.selectorName(n))
val useSelectors = vars.length <= 22
def selector(n: Int) =
if useSelectors then Select(Ident(tmpName), nme.selectorName(n))
else Apply(Select(Ident(tmpName), nme.apply), Literal(Constant(n)) :: Nil)
val restDefs =
for (((named, tpt), n) <- vars.zipWithIndex if named.name != nme.WILDCARD)
yield
Expand Down
1 change: 1 addition & 0 deletions compiler/test/dotc/pos-test-pickling.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ i5720.scala

# Tuples
toexproftuple.scala
i7580.scala

# Nullability
nullable.scala
5 changes: 5 additions & 0 deletions tests/pos/i7580.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

def foo =
val List(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, _:_*) = List.fill(25)(0)

()