Skip to content

Commit 263119a

Browse files
Replace usages of MatchType.InDisguise by underlyingMatchType
1 parent b39f490 commit 263119a

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

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

+3-14
Original file line numberDiff line numberDiff line change
@@ -5142,20 +5142,9 @@ object Types extends TypeUtils {
51425142
def apply(bound: Type, scrutinee: Type, cases: List[Type])(using Context): MatchType =
51435143
unique(new CachedMatchType(bound, scrutinee, cases))
51445144

5145-
def thatReducesUsingGadt(tp: Type)(using Context): Boolean = tp match
5146-
case MatchType.InDisguise(mt) => mt.reducesUsingGadt
5147-
case mt: MatchType => mt.reducesUsingGadt
5148-
case _ => false
5149-
5150-
/** Extractor for match types hidden behind an AppliedType/MatchAlias. */
5151-
object InDisguise:
5152-
def unapply(tp: AppliedType)(using Context): Option[MatchType] = tp match
5153-
case AppliedType(tycon: TypeRef, args) => tycon.info match
5154-
case MatchAlias(alias) => alias.applyIfParameterized(args) match
5155-
case mt: MatchType => Some(mt)
5156-
case _ => None
5157-
case _ => None
5158-
case _ => None
5145+
def thatReducesUsingGadt(tp: Type)(using Context): Boolean = tp.underlyingMatchType match
5146+
case mt: MatchType => mt.reducesUsingGadt
5147+
case _ => false
51595148
}
51605149

51615150
enum MatchTypeCasePattern:

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -1841,11 +1841,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
18411841
case _ => false
18421842
}
18431843

1844-
val result = pt match {
1844+
val result = pt.underlyingMatchType match {
18451845
case mt: MatchType if isMatchTypeShaped(mt) =>
18461846
typedDependentMatchFinish(tree, sel1, selType, tree.cases, mt)
1847-
case MatchType.InDisguise(mt) if isMatchTypeShaped(mt) =>
1848-
typedDependentMatchFinish(tree, sel1, selType, tree.cases, mt)
18491847
case _ =>
18501848
typedMatchFinish(tree, sel1, selType, tree.cases, pt)
18511849
}

0 commit comments

Comments
 (0)