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 {
1450
1450
else if is(Contravariant ) then Contravariant
1451
1451
else EmptyFlags
1452
1452
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 */
1454
1454
def nestingLevel (using Context ): Int =
1455
1455
@ tailrec def recur (d : SymDenotation , n : Int ): Int = d match
1456
+ case NoDenotation => n
1456
1457
case d : ClassDenotation => d.nestingLevel + n // profit from the cache in ClassDenotation
1457
1458
case _ => recur(d.owner, n + 1 )
1458
1459
recur(this , 0 )
@@ -2162,8 +2163,7 @@ object SymDenotations {
2162
2163
private var myNestingLevel = - 1
2163
2164
2164
2165
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
2167
2167
myNestingLevel
2168
2168
}
2169
2169
You can’t perform that action at this time.
0 commit comments