@@ -468,12 +468,10 @@ object Types extends TypeUtils {
468
468
/** Does this application expand to a match type? */
469
469
def isMatchAlias (using Context ): Boolean = underlyingMatchType.exists
470
470
471
- def underlyingMatchType (using Context ): Type = stripped match {
471
+ def underlyingMatchType (using Context ): Type = stripped match
472
472
case tp : MatchType => tp
473
- case tp : HKTypeLambda => tp.resType.underlyingMatchType
474
473
case tp : AppliedType => tp.underlyingMatchType
475
474
case _ => NoType
476
- }
477
475
478
476
/** Is this a higher-kinded type lambda with given parameter variances?
479
477
* These lambdas are used as the RHS of higher-kinded abstract types or
@@ -4647,35 +4645,23 @@ object Types extends TypeUtils {
4647
4645
4648
4646
/** Exists if the tycon is a TypeRef of an alias with an underlying match type.
4649
4647
* Anything else should have already been reduced in `appliedTo` by the TypeAssigner.
4648
+ * May reduce several HKTypeLambda applications before the underlying MatchType is reached.
4650
4649
*/
4651
4650
override def underlyingMatchType (using Context ): Type =
4652
4651
if ctx.period != validUnderlyingMatch then
4653
4652
validUnderlyingMatch = if tycon.isProvisional then Nowhere else ctx.period
4654
4653
cachedUnderlyingMatch = superType.underlyingMatchType
4655
4654
cachedUnderlyingMatch
4656
4655
4657
- override def tryNormalize (using Context ): Type = tycon.stripTypeVar match {
4658
- case tycon : TypeRef =>
4659
- def tryMatchAlias = tycon.info match
4660
- case AliasingBounds (alias) if isMatchAlias =>
4661
- trace(i " normalize $this" , typr, show = true ) {
4662
- MatchTypeTrace .recurseWith(this ) {
4663
- alias.applyIfParameterized(args).tryNormalize
4664
- /* `applyIfParameterized` may reduce several HKTypeLambda applications
4665
- * before the underlying MatchType is reached.
4666
- * Even if they do not involve any match type normalizations yet,
4667
- * we still want to record these reductions in the MatchTypeTrace.
4668
- * They should however only be attempted if they eventually expand
4669
- * to a match type, which is ensured by the `isMatchAlias` guard.
4670
- */
4671
- }
4672
- }
4673
- case _ =>
4674
- NoType
4675
- tryCompiletimeConstantFold.orElse(tryMatchAlias)
4676
- case _ =>
4677
- NoType
4678
- }
4656
+ override def tryNormalize (using Context ): Type =
4657
+ def tryMatchAlias =
4658
+ if isMatchAlias then trace(i " normalize $this" , typr, show = true ):
4659
+ if MatchTypeTrace .isRecording then
4660
+ MatchTypeTrace .recurseWith(this )(superType.tryNormalize)
4661
+ else
4662
+ underlyingMatchType.tryNormalize
4663
+ else NoType
4664
+ tryCompiletimeConstantFold.orElse(tryMatchAlias)
4679
4665
4680
4666
/** Is this an unreducible application to wildcard arguments?
4681
4667
* This is the case if tycon is higher-kinded. This means
0 commit comments