Skip to content

Commit 1354d0d

Browse files
committed
Cheaper test for isInteresting in cycle checking
1 parent 756ae34 commit 1354d0d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ object Symbols extends SymUtils {
134134
final def lastKnownDenotation: SymDenotation =
135135
lastDenot
136136

137-
private[core] def defRunId: RunId =
137+
private[dotc] def defRunId: RunId =
138138
lastDenot.validFor.runId
139139

140140
private inline def associatedFileMatches(inline filter: AbstractFile => Boolean)(using Context): Boolean =

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,10 @@ object Checking {
335335
!sym.is(Private) && prefix.derivesFrom(sym.owner)
336336
|| {
337337
val pcls = prefix.symbol.moduleClass
338-
if pcls.isStaticOwner then pcls.isDefinedInCurrentRun
339-
else isInteresting(prefix.prefix)
338+
if pcls.isStaticOwner then
339+
pcls.span.exists && pcls.defRunId == ctx.runId // cheaper approximation to isDefinedInCurrentRun
340+
else
341+
isInteresting(prefix.prefix)
340342
}
341343
case SuperType(thistp, _) => isInteresting(thistp)
342344
case AndType(tp1, tp2) => isInteresting(tp1) || isInteresting(tp2)

0 commit comments

Comments
 (0)