Skip to content

Commit 601cc5b

Browse files
authored
Merge pull request #11600 from dotty-staging/fix-memory-leak
Fix memory leak through NoDenotation.cachePrefix
2 parents 6e27e97 + 89d2b26 commit 601cc5b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ 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 =
132+
def asSeenFrom(pre: Type)(using Context): AsSeenFromResult =
133133
if (Config.cacheAsSeenFrom) {
134134
if ((cachedPrefix ne pre) || ctx.period != validAsSeenFrom) {
135135
cachedAsSeenFrom = computeAsSeenFrom(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)