Skip to content

Commit 89d2b26

Browse files
committed
Override asSeenFrom for performance
1 parent 7bdb249 commit 89d2b26

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ object Denotations {
129129
type AsSeenFromResult <: PreDenotation
130130

131131
/** The denotation with info(s) as seen from prefix type */
132-
final def asSeenFrom(pre: Type)(using Context): AsSeenFromResult =
133-
if (Config.cacheAsSeenFrom && exists) {
132+
def asSeenFrom(pre: Type)(using Context): AsSeenFromResult =
133+
if (Config.cacheAsSeenFrom) {
134134
if ((cachedPrefix ne pre) || ctx.period != validAsSeenFrom) {
135135
cachedAsSeenFrom = computeAsSeenFrom(pre)
136136
cachedPrefix = pre

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,8 +2209,8 @@ object SymDenotations {
22092209
ensureCompleted()
22102210
myCompanion
22112211

2212-
override def registeredCompanion_=(c: Symbol) =
2213-
myCompanion = c
2212+
override def registeredCompanion_=(c: Symbol) =
2213+
myCompanion = c
22142214

22152215
private var myNestingLevel = -1
22162216

@@ -2397,6 +2397,7 @@ object SymDenotations {
23972397
override def owner: Symbol = throw new AssertionError("NoDenotation.owner")
23982398
override def computeAsSeenFrom(pre: Type)(using Context): SingleDenotation = this
23992399
override def mapInfo(f: Type => Type)(using Context): SingleDenotation = this
2400+
override def asSeenFrom(pre: Type)(using Context): AsSeenFromResult = this
24002401

24012402
override def matches(other: SingleDenotation)(using Context): Boolean = false
24022403
override def targetName(using Context): Name = EmptyTermName

0 commit comments

Comments
 (0)