diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 2adb4886ac07..7f82e11ef8bf 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -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 diff --git a/compiler/test/dotc/pos-test-pickling.blacklist b/compiler/test/dotc/pos-test-pickling.blacklist index 59a9b8498080..e5c98b5666aa 100644 --- a/compiler/test/dotc/pos-test-pickling.blacklist +++ b/compiler/test/dotc/pos-test-pickling.blacklist @@ -28,6 +28,7 @@ i5720.scala # Tuples toexproftuple.scala +i7580.scala # Nullability nullable.scala diff --git a/tests/pos/i7580.scala b/tests/pos/i7580.scala new file mode 100644 index 000000000000..2e22da7fead9 --- /dev/null +++ b/tests/pos/i7580.scala @@ -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) + + ()