File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1450,9 +1450,10 @@ object SymDenotations {
14501450 else if is(Contravariant ) then Contravariant
14511451 else EmptyFlags
14521452
1453- /** The length of the owner chain of this symbol. 0 for _root_, undefined for NoSymbol */
1453+ /** The length of the owner chain of this symbol. 1 for _root_, 0 for NoSymbol */
14541454 def nestingLevel (using Context ): Int =
14551455 @ tailrec def recur (d : SymDenotation , n : Int ): Int = d match
1456+ case NoDenotation => n
14561457 case d : ClassDenotation => d.nestingLevel + n // profit from the cache in ClassDenotation
14571458 case _ => recur(d.owner, n + 1 )
14581459 recur(this , 0 )
@@ -2162,8 +2163,7 @@ object SymDenotations {
21622163 private var myNestingLevel = - 1
21632164
21642165 override def nestingLevel (using Context ) =
2165- if myNestingLevel == - 1 then
2166- myNestingLevel = if maybeOwner.exists then maybeOwner.nestingLevel + 1 else 0
2166+ if myNestingLevel == - 1 then myNestingLevel = owner.nestingLevel + 1
21672167 myNestingLevel
21682168 }
21692169
You can’t perform that action at this time.
0 commit comments