Skip to content

Commit 45e971f

Browse files
committed
Type match with a match type when a match type is expected
1 parent dc5a9a4 commit 45e971f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
15531553
case otherTpe => otherTpe.widen
15541554
/** Extractor for match types hidden behind an AppliedType/MatchAlias */
15551555
object MatchTypeInDisguise {
1556-
def unapply(tp: AppliedType)(using Context): Option[MatchType] = tp match {
1556+
def unapply(tp: Type)(using Context): Option[MatchType] = tp match {
15571557
case AppliedType(tycon: TypeRef, args) =>
15581558
tycon.info match {
15591559
case MatchAlias(alias) =>
@@ -1563,6 +1563,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
15631563
}
15641564
case _ => None
15651565
}
1566+
case mt: MatchType => Some(mt)
15661567
case _ => None
15671568
}
15681569
}

0 commit comments

Comments
 (0)