Skip to content

Fix auto-untupling for generic tuple types #23680

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

Closed
wants to merge 1 commit into from
Closed
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 compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ object Applications {
case argType :: Nil
if args.lengthCompare(1) > 0
&& Feature.autoTuplingEnabled
&& defn.isTupleNType(argType) =>
&& (defn.isTupleNType(argType) || argType.isSmallGenericTuple) =>
untpd.Tuple(args) :: Nil
case _ =>
args
Expand Down
8 changes: 8 additions & 0 deletions tests/pos/generic-untupling.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

def foo(x: Option[(Int, Boolean)]) = x match
case Some(a, b) => ??? // was ok
case None => ???

def bar(x: Option[Int *: Boolean *: EmptyTuple]) = x match
case Some(a, b) => ??? // was error, now ok
case None => ???
Loading