Skip to content

Commit

Permalink
Revert cache for signature in denot
Browse files Browse the repository at this point in the history
[Cherry-picked d9e13e5]
  • Loading branch information
noti0na1 authored and WojciechMazur committed Dec 3, 2024
1 parent b7d73cb commit bd567c1
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 @@ -621,30 +621,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 @@ -1047,8 +1023,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 bd567c1

Please sign in to comment.