Skip to content

Commit 389f5be

Browse files
Replace usages of isInstanceOf[MatchAlias] by isMatchAlias
1 parent 259a16c commit 389f5be

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
13751375
* tp1 <:< app2 using isSubType (this might instantiate params in tp2)
13761376
*/
13771377
def compareLower(tycon2bounds: TypeBounds, tyconIsTypeRef: Boolean): Boolean =
1378-
if ((tycon2bounds.lo `eq` tycon2bounds.hi) && !tycon2bounds.isInstanceOf[MatchAlias])
1378+
if ((tycon2bounds.lo `eq` tycon2bounds.hi) && !tycon2bounds.isMatchAlias)
13791379
if (tyconIsTypeRef) recur(tp1, tp2.superTypeNormalized) && recordGadtUsageIf(MatchType.thatReducesUsingGadt(tp2))
13801380
else isSubApproxHi(tp1, tycon2bounds.lo.applyIfParameterized(args2))
13811381
else

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

+4-15
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,15 @@ object Types extends TypeUtils {
456456
/** Is this a MethodType for which the parameters will not be used? */
457457
def hasErasedParams(using Context): Boolean = false
458458

459-
/** Is this a match type or a higher-kinded abstraction of one?
460-
*/
459+
/** Is this a match type or a higher-kinded abstraction of one? */
461460
def isMatch(using Context): Boolean = stripped match
462461
case tp: MatchType => true
463462
case tp: HKTypeLambda => tp.resType.isMatch
464463
case _ => false
465464

465+
/** Does this application expand to a match type? */
466+
def isMatchAlias(using Context): Boolean = underlyingMatchType.exists
467+
466468
def underlyingMatchType(using Context): Type = stripped match {
467469
case tp: MatchType => tp
468470
case tp: HKTypeLambda => tp.resType.underlyingMatchType
@@ -4611,19 +4613,6 @@ object Types extends TypeUtils {
46114613
NoType
46124614
}
46134615

4614-
/** Does this application expand to a match type? */
4615-
def isMatchAlias(using Context): Boolean = tycon.stripTypeVar match
4616-
case tycon: TypeRef =>
4617-
tycon.info match
4618-
case AliasingBounds(alias) =>
4619-
alias.underlyingMatchType.exists
4620-
/* This is the only true case since anything other than
4621-
* a TypeRef of an alias with an underlying match type
4622-
* should have been already reduced by `appliedTo` in the TypeAssigner.
4623-
*/
4624-
case _ => false
4625-
case _ => false
4626-
46274616
/** Is this an unreducible application to wildcard arguments?
46284617
* This is the case if tycon is higher-kinded. This means
46294618
* it is a subtype of a hk-lambda, but not a match alias.

Diff for: compiler/src/dotty/tools/dotc/typer/Implicits.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ trait ImplicitRunInfo:
622622
sym.isClass && !isExcluded(sym)
623623
|| sym.isOpaqueAlias
624624
|| sym.is(Deferred, butNot = Param)
625-
|| sym.info.isInstanceOf[MatchAlias]
625+
|| sym.info.isMatchAlias
626626

627627
private def computeIScope(rootTp: Type): OfTypeImplicits =
628628

0 commit comments

Comments
 (0)