Skip to content

Commit 2aa2551

Browse files
authored
Merge pull request #13063 from dwijnand/avoid-auto-tupling
2 parents e55a781 + bc0e5fc commit 2aa2551

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-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
@@ -1360,7 +1360,7 @@ trait Applications extends Compatibility {
13601360
for (argType <- argTypes) assert(!isBounds(argType), unapplyApp.tpe.show)
13611361
val bunchedArgs = argTypes match {
13621362
case argType :: Nil =>
1363-
if (args.lengthCompare(1) > 0 && Feature.autoTuplingEnabled) untpd.Tuple(args) :: Nil
1363+
if (args.lengthCompare(1) > 0 && Feature.autoTuplingEnabled && defn.isTupleType(argType)) untpd.Tuple(args) :: Nil
13641364
else args
13651365
case _ => args
13661366
}

tests/neg/i10757.check

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- [E107] Syntax Error: tests/neg/i10757.scala:4:10 --------------------------------------------------------------------
2+
4 | case Var(name, _) => name: String // error
3+
| ^^^^^^^^^^^^
4+
| Wrong number of argument patterns for Var; expected: (String)
5+
6+
longer explanation available when compiling with `-explain`

tests/neg/i10757.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
case class Var(name: String)
2+
3+
@main def f = Var("a") match
4+
case Var(name, _) => name: String // error

0 commit comments

Comments
 (0)