@@ -466,11 +466,11 @@ object Types extends TypeUtils {
466
466
case _ => false
467
467
468
468
/** Does this application expand to a match type? */
469
- def isMatchAlias (using Context ): Boolean = underlyingMatchType.exists
469
+ def isMatchAlias (using Context ): Boolean = underlyingNormalizable.isMatch
470
470
471
- def underlyingMatchType (using Context ): Type = stripped match
471
+ def underlyingNormalizable (using Context ): Type = stripped match
472
472
case tp : MatchType => tp
473
- case tp : AppliedType => tp.underlyingMatchType
473
+ case tp : AppliedType => tp.underlyingNormalizable
474
474
case _ => NoType
475
475
476
476
/** Is this a higher-kinded type lambda with given parameter variances?
@@ -4584,8 +4584,8 @@ object Types extends TypeUtils {
4584
4584
private var myEvalRunId : RunId = NoRunId
4585
4585
private var myEvalued : Type = uninitialized
4586
4586
4587
- private var validUnderlyingMatch : Period = Nowhere
4588
- private var cachedUnderlyingMatch : Type = uninitialized
4587
+ private var validUnderlyingNormalizable : Period = Nowhere
4588
+ private var cachedUnderlyingNormalizable : Type = uninitialized
4589
4589
4590
4590
def isGround (acc : TypeAccumulator [Boolean ])(using Context ): Boolean =
4591
4591
if myGround == 0 then myGround = if acc.foldOver(true , this ) then 1 else - 1
@@ -4647,19 +4647,21 @@ object Types extends TypeUtils {
4647
4647
* Anything else should have already been reduced in `appliedTo` by the TypeAssigner.
4648
4648
* May reduce several HKTypeLambda applications before the underlying MatchType is reached.
4649
4649
*/
4650
- override def underlyingMatchType (using Context ): Type =
4651
- if ctx.period != validUnderlyingMatch then
4652
- validUnderlyingMatch = if tycon.isProvisional then Nowhere else ctx.period
4653
- cachedUnderlyingMatch = superType.underlyingMatchType
4654
- cachedUnderlyingMatch
4650
+ override def underlyingNormalizable (using Context ): Type =
4651
+ if ctx.period != validUnderlyingNormalizable then
4652
+ validUnderlyingNormalizable = if tycon.isProvisional then Nowhere else ctx.period
4653
+ cachedUnderlyingNormalizable = tycon match
4654
+ case tycon : TypeRef if defn.isCompiletimeAppliedType(tycon.symbol) => this
4655
+ case _ => superType.underlyingNormalizable
4656
+ cachedUnderlyingNormalizable
4655
4657
4656
4658
override def tryNormalize (using Context ): Type =
4657
4659
def tryMatchAlias =
4658
4660
if isMatchAlias then trace(i " normalize $this" , typr, show = true ):
4659
4661
if MatchTypeTrace .isRecording then
4660
4662
MatchTypeTrace .recurseWith(this )(superType.tryNormalize)
4661
4663
else
4662
- underlyingMatchType .tryNormalize
4664
+ underlyingNormalizable .tryNormalize
4663
4665
else NoType
4664
4666
tryCompiletimeConstantFold.orElse(tryMatchAlias)
4665
4667
@@ -5197,7 +5199,7 @@ object Types extends TypeUtils {
5197
5199
def apply (bound : Type , scrutinee : Type , cases : List [Type ])(using Context ): MatchType =
5198
5200
unique(new CachedMatchType (bound, scrutinee, cases))
5199
5201
5200
- def thatReducesUsingGadt (tp : Type )(using Context ): Boolean = tp.underlyingMatchType match
5202
+ def thatReducesUsingGadt (tp : Type )(using Context ): Boolean = tp.underlyingNormalizable match
5201
5203
case mt : MatchType => mt.reducesUsingGadt
5202
5204
case _ => false
5203
5205
0 commit comments