Skip to content

Commit 39b3db3

Browse files
eejbyfeldttgodzik
authored andcommitted
Only track types in from LazyRef
[Cherry-picked 8a0bbdf]
1 parent 9d5bb69 commit 39b3db3

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
@@ -6587,7 +6587,6 @@ object Types extends TypeUtils {
65876587
class TypeSizeAccumulator(using Context) extends TypeAccumulator[Int] {
65886588
var seen = util.HashSet[Type](initialCapacity = 8)
65896589
def apply(n: Int, tp: Type): Int =
6590-
seen += tp
65916590
tp match {
65926591
case tp: AppliedType =>
65936592
val tpNorm = tp.tryNormalize
@@ -6599,8 +6598,11 @@ object Types extends TypeUtils {
65996598
apply(n, tp.superType)
66006599
case tp: TypeParamRef =>
66016600
apply(n, TypeComparer.bounds(tp))
6602-
case tp: LazyRef if seen.contains(tp) =>
6603-
n
6601+
case tp: LazyRef =>
6602+
if seen.contains(tp) then n
6603+
else
6604+
seen += tp
6605+
foldOver(n, tp)
66046606
case _ =>
66056607
foldOver(n, tp)
66066608
}

0 commit comments

Comments
 (0)