Skip to content

Commit 259a16c

Browse files
Replace usages of MatchType.InDisguise by underlyingMatchType
1 parent ef7db7a commit 259a16c

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/TypeOps.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ object TypeOps:
143143
defn.MatchCase(simplify(pat, theMap), body)
144144
case tp: AppliedType =>
145145
tp.tycon match
146-
case tycon: TypeRef if tycon.info.isInstanceOf[MatchAlias] =>
146+
case tycon: TypeRef if tp.isMatchAlias =>
147147
isFullyDefined(tp, ForceDegree.all)
148148
case _ =>
149149
val normed = tp.tryNormalize

Diff for: compiler/src/dotty/tools/dotc/core/Types.scala

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

5154-
def thatReducesUsingGadt(tp: Type)(using Context): Boolean = tp match
5155-
case MatchType.InDisguise(mt) => mt.reducesUsingGadt
5156-
case mt: MatchType => mt.reducesUsingGadt
5157-
case _ => false
5158-
5159-
/** Extractor for match types hidden behind an AppliedType/MatchAlias. */
5160-
object InDisguise:
5161-
def unapply(tp: AppliedType)(using Context): Option[MatchType] = tp match
5162-
case AppliedType(tycon: TypeRef, args) => tycon.info match
5163-
case MatchAlias(alias) => alias.applyIfParameterized(args) match
5164-
case mt: MatchType => Some(mt)
5165-
case _ => None
5166-
case _ => None
5167-
case _ => None
5154+
def thatReducesUsingGadt(tp: Type)(using Context): Boolean = tp.underlyingMatchType match
5155+
case mt: MatchType => mt.reducesUsingGadt
5156+
case _ => false
51685157
}
51695158

51705159
enum MatchTypeCasePattern:

Diff for: 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)