@@ -491,12 +491,10 @@ object Types extends TypeUtils {
491
491
/** Does this application expand to a match type? */
492
492
def isMatchAlias (using Context ): Boolean = underlyingMatchType.exists
493
493
494
- def underlyingMatchType (using Context ): Type = stripped match {
494
+ def underlyingMatchType (using Context ): Type = stripped match
495
495
case tp : MatchType => tp
496
- case tp : HKTypeLambda => tp.resType.underlyingMatchType
497
496
case tp : AppliedType => tp.underlyingMatchType
498
497
case _ => NoType
499
- }
500
498
501
499
/** Is this a higher-kinded type lambda with given parameter variances?
502
500
* These lambdas are used as the RHS of higher-kinded abstract types or
@@ -4681,35 +4679,23 @@ object Types extends TypeUtils {
4681
4679
4682
4680
/** Exists if the tycon is a TypeRef of an alias with an underlying match type.
4683
4681
* Anything else should have already been reduced in `appliedTo` by the TypeAssigner.
4682
+ * May reduce several HKTypeLambda applications before the underlying MatchType is reached.
4684
4683
*/
4685
4684
override def underlyingMatchType (using Context ): Type =
4686
4685
if ctx.period != validUnderlyingMatch then
4687
4686
cachedUnderlyingMatch = superType.underlyingMatchType
4688
4687
validUnderlyingMatch = validSuper
4689
4688
cachedUnderlyingMatch
4690
4689
4691
- override def tryNormalize (using Context ): Type = tycon.stripTypeVar match {
4692
- case tycon : TypeRef =>
4693
- def tryMatchAlias = tycon.info match
4694
- case AliasingBounds (alias) if isMatchAlias =>
4695
- trace(i " normalize $this" , typr, show = true ) {
4696
- MatchTypeTrace .recurseWith(this ) {
4697
- alias.applyIfParameterized(args).tryNormalize
4698
- /* `applyIfParameterized` may reduce several HKTypeLambda applications
4699
- * before the underlying MatchType is reached.
4700
- * Even if they do not involve any match type normalizations yet,
4701
- * we still want to record these reductions in the MatchTypeTrace.
4702
- * They should however only be attempted if they eventually expand
4703
- * to a match type, which is ensured by the `isMatchAlias` guard.
4704
- */
4705
- }
4706
- }
4707
- case _ =>
4708
- NoType
4709
- tryCompiletimeConstantFold.orElse(tryMatchAlias)
4710
- case _ =>
4711
- NoType
4712
- }
4690
+ override def tryNormalize (using Context ): Type =
4691
+ def tryMatchAlias =
4692
+ if isMatchAlias then trace(i " normalize $this" , typr, show = true ):
4693
+ if MatchTypeTrace .isRecording then
4694
+ MatchTypeTrace .recurseWith(this )(superType.tryNormalize)
4695
+ else
4696
+ underlyingMatchType.tryNormalize
4697
+ else NoType
4698
+ tryCompiletimeConstantFold.orElse(tryMatchAlias)
4713
4699
4714
4700
/** Is this an unreducible application to wildcard arguments?
4715
4701
* This is the case if tycon is higher-kinded. This means
0 commit comments