Skip to content

Commit 679fd17

Browse files
oderskyWojciechMazur
authored andcommitted
Cheaper test for isInteresting in cycle checking
[Cherry-picked 1354d0d]
1 parent d74f680 commit 679fd17

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ object Symbols extends SymUtils {
129129
final def lastKnownDenotation: SymDenotation =
130130
lastDenot
131131

132-
private[core] def defRunId: RunId =
132+
private[dotc] def defRunId: RunId =
133133
lastDenot.validFor.runId
134134

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

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,10 @@ object Checking {
322322
!sym.is(Private) && prefix.derivesFrom(sym.owner)
323323
|| {
324324
val pcls = prefix.symbol.moduleClass
325-
if pcls.isStaticOwner then pcls.isDefinedInCurrentRun
326-
else isInteresting(prefix.prefix)
325+
if pcls.isStaticOwner then
326+
pcls.span.exists && pcls.defRunId == ctx.runId // cheaper approximation to isDefinedInCurrentRun
327+
else
328+
isInteresting(prefix.prefix)
327329
}
328330
case SuperType(thistp, _) => isInteresting(thistp)
329331
case AndType(tp1, tp2) => isInteresting(tp1) || isInteresting(tp2)

0 commit comments

Comments
 (0)