Skip to content

Commit 1edc413

Browse files
Fix #15405: Dealias Or type constituents when finding its dominator
1 parent 9614fb9 commit 1edc413

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ object TypeOps:
345345
}
346346

347347
// Step 3: Intersect base classes of both sides
348-
val commonBaseClasses = tp.mapReduceOr(_.baseClasses)(intersect)
348+
val commonBaseClasses = tp.mapReduceOr(_.dealias.baseClasses)(intersect)
349349
val doms = dominators(commonBaseClasses, Nil)
350350
def baseTp(cls: ClassSymbol): Type =
351351
tp.baseType(cls).mapReduceOr(identity)(mergeRefinedOrApplied)

tests/pos/i15405.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type Validated[A] = A
2+
class Foo:
3+
def >(x: Int) = true
4+
def foo(v: Foo|Validated[Foo]): Unit = v > 10

0 commit comments

Comments
 (0)