diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index b677dae3a38b..489635965398 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -3508,7 +3508,7 @@ class MatchReducer(initctx: Context) extends TypeComparer(initctx) { stableScrut.member(typeMemberName) match case denot: SingleDenotation if denot.exists => val info = denot.info match - case TypeAlias(alias) => alias // Extract the alias + case alias: AliasingBounds => alias.alias // Extract the alias case ClassInfo(prefix, cls, _, _, _) => prefix.select(cls) // Re-select the class from the prefix case info => info // Notably, RealTypeBounds, which will eventually give a MatchResult.NoInstances val infoRefersToSkolem = stableScrut.isInstanceOf[SkolemType] && stableScrut.occursIn(info) diff --git a/tests/pos/match-type-extract-matchalias.scala b/tests/pos/match-type-extract-matchalias.scala new file mode 100644 index 000000000000..35a6ecd05a3c --- /dev/null +++ b/tests/pos/match-type-extract-matchalias.scala @@ -0,0 +1,11 @@ +trait Base: + type Value +trait Sub[T <: NonEmptyTuple] extends Base: + type Value = Tuple.Head[T] +object Base: + type BaseOf[V] = Base { type Value = V } + type ExtractValue[B <: Base] = B match + case BaseOf[v] => v + +class Test: + val test: Base.ExtractValue[Sub[Int *: EmptyTuple]] = 1