Skip to content

Commit b88d4c6

Browse files
committed
Refine handling of pattern binders for large tuples
1 parent 582ebd0 commit b88d4c6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2447,7 +2447,13 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
24472447
// wrt to operand order for `&`, we include the explicit subtype test here.
24482448
// See also #5649.
24492449
then body1.tpe
2450-
else pt & body1.tpe
2450+
else body1.tpe match
2451+
case btpe: TypeRef
2452+
if btpe.symbol == defn.TupleXXLClass && pt.tupleElementTypes.isDefined =>
2453+
// leave the original tuple type; don't mix with & TupleXXL which would only obscure things
2454+
pt
2455+
case _ =>
2456+
pt & body1.tpe
24512457
val sym = newPatternBoundSymbol(name, symTp, tree.span)
24522458
if (pt == defn.ImplicitScrutineeTypeRef || tree.mods.is(Given)) sym.setFlag(Given)
24532459
if (ctx.mode.is(Mode.InPatternAlternative))

0 commit comments

Comments
 (0)