@@ -626,6 +626,30 @@ object Denotations {
626626 throw ex
627627 case _ => Signature .NotAMethod
628628
629+ private var myCurrentJavaSig : Signature = uninitialized
630+ private var myCurrentJavaSigRunId : RunId = NoRunId
631+ private var myCurrentScala2Sig : Signature = uninitialized
632+ private var myCurrentScala2SigRunId : RunId = NoRunId
633+ private var myCurrentSig : Signature = uninitialized
634+ private var myCurrentSigRunId : RunId = NoRunId
635+
636+ def currentSignature (sourceLanguage : SourceLanguage )(using Context ): Signature = sourceLanguage match
637+ case SourceLanguage .Java =>
638+ if myCurrentJavaSigRunId != ctx.runId then
639+ myCurrentJavaSig = signature(sourceLanguage)
640+ myCurrentJavaSigRunId = ctx.runId
641+ myCurrentJavaSig
642+ case SourceLanguage .Scala2 =>
643+ if myCurrentScala2SigRunId != ctx.runId then
644+ myCurrentScala2Sig = signature(sourceLanguage)
645+ myCurrentScala2SigRunId = ctx.runId
646+ myCurrentScala2Sig
647+ case SourceLanguage .Scala3 =>
648+ if myCurrentSigRunId != ctx.runId then
649+ myCurrentSig = signature(sourceLanguage)
650+ myCurrentSigRunId = ctx.runId
651+ myCurrentSig
652+
629653 def derivedSingleDenotation (symbol : Symbol , info : Type , pre : Type = this .prefix, isRefinedMethod : Boolean = this .isRefinedMethod)(using Context ): SingleDenotation =
630654 if ((symbol eq this .symbol) && (info eq this .info) && (pre eq this .prefix) && (isRefinedMethod == this .isRefinedMethod)) this
631655 else newLikeThis(symbol, info, pre, isRefinedMethod)
@@ -1033,8 +1057,8 @@ object Denotations {
10331057 val thisLanguage = SourceLanguage (symbol)
10341058 val otherLanguage = SourceLanguage (other.symbol)
10351059 val commonLanguage = SourceLanguage .commonLanguage(thisLanguage, otherLanguage)
1036- val sig = signature (commonLanguage)
1037- val otherSig = other.signature (commonLanguage)
1060+ val sig = currentSignature (commonLanguage)
1061+ val otherSig = other.currentSignature (commonLanguage)
10381062 sig.matchDegree(otherSig) match
10391063 case FullMatch =>
10401064 ! alwaysCompareTypes || info.matches(other.info)
0 commit comments