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