Skip to content

Commit

Permalink
Cheaper test for isInteresting in cycle checking
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jan 16, 2024
1 parent 756ae34 commit 1354d0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ object Symbols extends SymUtils {
final def lastKnownDenotation: SymDenotation =
lastDenot

private[core] def defRunId: RunId =
private[dotc] def defRunId: RunId =
lastDenot.validFor.runId

private inline def associatedFileMatches(inline filter: AbstractFile => Boolean)(using Context): Boolean =
Expand Down
6 changes: 4 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,10 @@ object Checking {
!sym.is(Private) && prefix.derivesFrom(sym.owner)
|| {
val pcls = prefix.symbol.moduleClass
if pcls.isStaticOwner then pcls.isDefinedInCurrentRun
else isInteresting(prefix.prefix)
if pcls.isStaticOwner then
pcls.span.exists && pcls.defRunId == ctx.runId // cheaper approximation to isDefinedInCurrentRun
else
isInteresting(prefix.prefix)
}
case SuperType(thistp, _) => isInteresting(thistp)
case AndType(tp1, tp2) => isInteresting(tp1) || isInteresting(tp2)
Expand Down

0 comments on commit 1354d0d

Please sign in to comment.