Skip to content

Commit 9e6a756

Browse files
eejbyfeldtWojciechMazur
authored andcommitted
Only track types in from LazyRef
[Cherry-picked 8a0bbdf]
1 parent f7abc2d commit 9e6a756

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7024,7 +7024,6 @@ object Types extends TypeUtils {
70247024
class TypeSizeAccumulator(using Context) extends TypeAccumulator[Int] {
70257025
var seen = util.HashSet[Type](initialCapacity = 8)
70267026
def apply(n: Int, tp: Type): Int =
7027-
seen += tp
70287027
tp match {
70297028
case tp: AppliedType =>
70307029
val tpNorm = tp.tryNormalize
@@ -7036,8 +7035,11 @@ object Types extends TypeUtils {
70367035
apply(n, tp.superType)
70377036
case tp: TypeParamRef =>
70387037
apply(n, TypeComparer.bounds(tp))
7039-
case tp: LazyRef if seen.contains(tp) =>
7040-
n
7038+
case tp: LazyRef =>
7039+
if seen.contains(tp) then n
7040+
else
7041+
seen += tp
7042+
foldOver(n, tp)
70417043
case _ =>
70427044
foldOver(n, tp)
70437045
}

0 commit comments

Comments
 (0)