Skip to content

Commit 094c963

Browse files
committed
Revert "Drop seemingly needless OrType#join"
This reverts commit 9ea195f.
1 parent 9ea195f commit 094c963

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ object PatternMatcher {
336336

337337
if (isSyntheticScala2Unapply(unapp.symbol) && caseAccessors.length == args.length)
338338
def tupleSel(sym: Symbol) = ref(scrutinee).select(sym)
339-
val isGenericTuple = defn.isTupleClass(caseClass) && !defn.isTupleNType(tree.tpe)
339+
val isGenericTuple = defn.isTupleClass(caseClass) &&
340+
!defn.isTupleNType(tree.tpe match { case tp: OrType => tp.join case tp => tp }) // widen even hard unions, to see if it's a union of tuples
340341
val components = if isGenericTuple then caseAccessors.indices.toList.map(tupleApp(_, ref(scrutinee))) else caseAccessors.map(tupleSel)
341342
matchArgsPlan(components, args, onSuccess)
342343
else if (unapp.tpe <:< (defn.BooleanType))

0 commit comments

Comments
 (0)