Skip to content

Commit b1fb67c

Browse files
Fix auto-untupling for generic tuple types
This makes the behaviour of auto-untupling consistent between the usual and generic tuples. Related to #23602
1 parent 53bea78 commit b1fb67c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ object Applications {
280280
case argType :: Nil
281281
if args.lengthCompare(1) > 0
282282
&& Feature.autoTuplingEnabled
283-
&& defn.isTupleNType(argType) =>
283+
&& (defn.isTupleNType(argType) || argType.isSmallGenericTuple) =>
284284
untpd.Tuple(args) :: Nil
285285
case _ =>
286286
args

tests/pos/generic-untupling.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
def foo(x: Option[(Int, Boolean)]) = x match
3+
case Some(a, b) => ??? // was ok
4+
case None => ???
5+
6+
def bar(x: Option[Int *: Boolean *: EmptyTuple]) = x match
7+
case Some(a, b) => ??? // was error, now ok
8+
case None => ???

0 commit comments

Comments
 (0)