Skip to content

Commit 8a0bbdf

Browse files
committed
Only track types in from LazyRef
1 parent 008d58e commit 8a0bbdf

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
@@ -7046,7 +7046,6 @@ object Types extends TypeUtils {
70467046
class TypeSizeAccumulator(using Context) extends TypeAccumulator[Int] {
70477047
var seen = util.HashSet[Type](initialCapacity = 8)
70487048
def apply(n: Int, tp: Type): Int =
7049-
seen += tp
70507049
tp match {
70517050
case tp: AppliedType =>
70527051
val tpNorm = tp.tryNormalize
@@ -7058,8 +7057,11 @@ object Types extends TypeUtils {
70587057
apply(n, tp.superType)
70597058
case tp: TypeParamRef =>
70607059
apply(n, TypeComparer.bounds(tp))
7061-
case tp: LazyRef if seen.contains(tp) =>
7062-
n
7060+
case tp: LazyRef =>
7061+
if seen.contains(tp) then n
7062+
else
7063+
seen += tp
7064+
foldOver(n, tp)
70637065
case _ =>
70647066
foldOver(n, tp)
70657067
}

0 commit comments

Comments
 (0)