Skip to content

Commit 7830296

Browse files
authored
Merge pull request #9835 from dotty-staging/fix-#9788
Fix #9788: Skip *: when computing erased lub
2 parents 18578b3 + a7c62b1 commit 7830296

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/core/TypeErasure.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,10 @@ object TypeErasure {
331331
val candidates = takeUntil(tp2superclasses)(!_.is(Trait))
332332

333333
// Candidates st "no other common superclass or trait derives from S"
334+
// Also, drop `PairClass` since it is not valid after erasue
334335
val minimums = candidates.filter { cand =>
335-
candidates.forall(x => !x.derivesFrom(cand) || x.eq(cand))
336+
cand != defn.PairClass
337+
&& candidates.forall(x => !x.derivesFrom(cand) || x.eq(cand))
336338
}
337339

338340
// Pick the last minimum to prioritise classes over traits

tests/pos/i9788.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
case class A(x: (Unit, Unit) | (Unit, Unit, Unit))

0 commit comments

Comments
 (0)