File tree 1 file changed +21
-4
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -4407,6 +4407,10 @@ object Types {
4407
4407
private var myEvalRunId : RunId = NoRunId
4408
4408
private var myEvalued : Type = uninitialized
4409
4409
4410
+ private var myReducing : Boolean = false
4411
+ private var myUnreduced : Type = uninitialized
4412
+ private var myUnreduceRunId : RunId = NoRunId
4413
+
4410
4414
def isGround (acc : TypeAccumulator [Boolean ])(using Context ): Boolean =
4411
4415
if myGround == 0 then myGround = if acc.foldOver(true , this ) then 1 else - 1
4412
4416
myGround > 0
@@ -4467,10 +4471,23 @@ object Types {
4467
4471
case tycon : TypeRef =>
4468
4472
def tryMatchAlias = tycon.info match {
4469
4473
case MatchAlias (alias) =>
4470
- trace(i " normalize $this" , typr, show = true ) {
4471
- MatchTypeTrace .recurseWith(this ) {
4472
- alias.applyIfParameterized(args.map(_.normalized)).tryNormalize
4473
- }
4474
+ trace(i " normalize( $this) " , typr) {
4475
+ if myReducing then
4476
+ NoType
4477
+ else try
4478
+ myReducing = true
4479
+ MatchTypeTrace .recurseWith(this ) {
4480
+ val app = if myUnreduceRunId != ctx.runId then
4481
+ val app = alias.applyIfParameterized(args)
4482
+ if ! isProvisional then
4483
+ myUnreduced = app
4484
+ myUnreduceRunId = ctx.runId
4485
+ app
4486
+ else myUnreduced
4487
+ val norm = app.tryNormalize
4488
+ if norm eq this then NoType else norm
4489
+ }
4490
+ finally myReducing = false
4474
4491
}
4475
4492
case _ =>
4476
4493
NoType
You can’t perform that action at this time.
0 commit comments