@@ -458,14 +458,16 @@ object Types extends TypeUtils {
458458
459459 /** Is this a match type or a higher-kinded abstraction of one?
460460 */
461- def isMatch (using Context ): Boolean = underlyingMatchType.exists
461+ def isMatch (using Context ): Boolean = stripped match
462+ case tp : MatchType => true
463+ case tp : HKTypeLambda => tp.resType.isMatch
464+ case _ => false
462465
463- def underlyingMatchType (using Context ): Type = stripped match {
466+ def underlyingMatchType (using Context ): Type = stripped match
464467 case tp : MatchType => tp
465468 case tp : HKTypeLambda => tp.resType.underlyingMatchType
466469 case tp : AppliedType if tp.isMatchAlias => tp.superType.underlyingMatchType
467470 case _ => NoType
468- }
469471
470472 /** Is this a higher-kinded type lambda with given parameter variances?
471473 * These lambdas are used as the RHS of higher-kinded abstract types or
@@ -4578,16 +4580,15 @@ object Types extends TypeUtils {
45784580
45794581 override def tryNormalize (using Context ): Type = tycon.stripTypeVar match {
45804582 case tycon : TypeRef =>
4581- def tryMatchAlias = tycon.info match {
4582- case MatchAlias (alias) =>
4583+ def tryMatchAlias = tycon.info match
4584+ case info : AliasingBounds if isMatchAlias =>
45834585 trace(i " normalize $this" , typr, show = true ) {
45844586 MatchTypeTrace .recurseWith(this ) {
4585- alias.applyIfParameterized(args.map(_.normalized)).tryNormalize
4587+ info. alias.applyIfParameterized(args.map(_.normalized)).tryNormalize
45864588 }
45874589 }
45884590 case _ =>
45894591 NoType
4590- }
45914592 tryCompiletimeConstantFold.orElse(tryMatchAlias)
45924593 case _ =>
45934594 NoType
@@ -4598,6 +4599,7 @@ object Types extends TypeUtils {
45984599 case tycon : TypeRef =>
45994600 tycon.info match
46004601 case _ : MatchAlias => true
4602+ case TypeAlias (alias) => alias.underlyingMatchType.exists
46014603 case _ => false
46024604 case _ => false
46034605
0 commit comments