Skip to content

Commit

Permalink
Revert cache for signature in denot
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Sep 18, 2024
1 parent 69c16f8 commit d9e13e5
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions compiler/src/dotty/tools/dotc/core/Denotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -626,30 +626,6 @@ object Denotations {
throw ex
case _ => Signature.NotAMethod

private var myCurrentJavaSig: Signature = uninitialized
private var myCurrentJavaSigRunId: RunId = NoRunId
private var myCurrentScala2Sig: Signature = uninitialized
private var myCurrentScala2SigRunId: RunId = NoRunId
private var myCurrentSig: Signature = uninitialized
private var myCurrentSigRunId: RunId = NoRunId

def currentSignature(sourceLanguage: SourceLanguage)(using Context): Signature = sourceLanguage match
case SourceLanguage.Java =>
if myCurrentJavaSigRunId != ctx.runId then
myCurrentJavaSig = signature(sourceLanguage)
myCurrentJavaSigRunId = ctx.runId
myCurrentJavaSig
case SourceLanguage.Scala2 =>
if myCurrentScala2SigRunId != ctx.runId then
myCurrentScala2Sig = signature(sourceLanguage)
myCurrentScala2SigRunId = ctx.runId
myCurrentScala2Sig
case SourceLanguage.Scala3 =>
if myCurrentSigRunId != ctx.runId then
myCurrentSig = signature(sourceLanguage)
myCurrentSigRunId = ctx.runId
myCurrentSig

def derivedSingleDenotation(symbol: Symbol, info: Type, pre: Type = this.prefix, isRefinedMethod: Boolean = this.isRefinedMethod)(using Context): SingleDenotation =
if ((symbol eq this.symbol) && (info eq this.info) && (pre eq this.prefix) && (isRefinedMethod == this.isRefinedMethod)) this
else newLikeThis(symbol, info, pre, isRefinedMethod)
Expand Down Expand Up @@ -1057,8 +1033,8 @@ object Denotations {
val thisLanguage = SourceLanguage(symbol)
val otherLanguage = SourceLanguage(other.symbol)
val commonLanguage = SourceLanguage.commonLanguage(thisLanguage, otherLanguage)
val sig = currentSignature(commonLanguage)
val otherSig = other.currentSignature(commonLanguage)
val sig = signature(commonLanguage)
val otherSig = other.signature(commonLanguage)
sig.matchDegree(otherSig) match
case FullMatch =>
!alwaysCompareTypes || info.matches(other.info)
Expand Down

0 comments on commit d9e13e5

Please sign in to comment.