@@ -477,7 +477,7 @@ object Denotations {
477
477
val jointInfo = infoMeet(info1, info2, safeIntersection)
478
478
if jointInfo.exists then
479
479
val sym = if symScore >= 0 then sym1 else sym2
480
- JointRefDenotation (sym, jointInfo, denot1.validFor & denot2.validFor, pre)
480
+ JointRefDenotation (sym, jointInfo, denot1.validFor & denot2.validFor, pre, denot1.isRefinedMethod || denot2.isRefinedMethod )
481
481
else if symScore == 2 then denot1
482
482
else if symScore == - 2 then denot2
483
483
else
@@ -569,7 +569,7 @@ object Denotations {
569
569
570
570
/** A non-overloaded denotation */
571
571
abstract class SingleDenotation (symbol : Symbol , initInfo : Type ) extends Denotation (symbol, initInfo) {
572
- protected def newLikeThis (symbol : Symbol , info : Type , pre : Type ): SingleDenotation
572
+ protected def newLikeThis (symbol : Symbol , info : Type , pre : Type , isRefinedMethod : Boolean ): SingleDenotation
573
573
574
574
final def name (using Context ): Name = symbol.name
575
575
@@ -582,6 +582,9 @@ object Denotations {
582
582
*/
583
583
def prefix : Type = NoPrefix
584
584
585
+ /** True if the info of this denotation comes from a refinement. */
586
+ def isRefinedMethod : Boolean = false
587
+
585
588
/** For SymDenotations, the language-specific signature of the info, depending on
586
589
* where the symbol is defined. For non-SymDenotations, the Scala 3
587
590
* signature.
@@ -615,9 +618,9 @@ object Denotations {
615
618
case _ => Signature .NotAMethod
616
619
}
617
620
618
- def derivedSingleDenotation (symbol : Symbol , info : Type , pre : Type = this .prefix)(using Context ): SingleDenotation =
619
- if ((symbol eq this .symbol) && (info eq this .info) && (pre eq this .prefix)) this
620
- else newLikeThis(symbol, info, pre)
621
+ def derivedSingleDenotation (symbol : Symbol , info : Type , pre : Type = this .prefix, isRefinedMethod : Boolean = this .isRefinedMethod )(using Context ): SingleDenotation =
622
+ if ((symbol eq this .symbol) && (info eq this .info) && (pre eq this .prefix) && (isRefinedMethod == this .isRefinedMethod) ) this
623
+ else newLikeThis(symbol, info, pre, isRefinedMethod )
621
624
622
625
def mapInfo (f : Type => Type )(using Context ): SingleDenotation =
623
626
derivedSingleDenotation(symbol, f(info))
@@ -1126,26 +1129,30 @@ object Denotations {
1126
1129
prefix : Type ) extends NonSymSingleDenotation (symbol, initInfo, prefix) {
1127
1130
validFor = initValidFor
1128
1131
override def hasUniqueSym : Boolean = true
1129
- protected def newLikeThis (s : Symbol , i : Type , pre : Type ): SingleDenotation =
1130
- new UniqueRefDenotation (s, i, validFor, pre)
1132
+ protected def newLikeThis (s : Symbol , i : Type , pre : Type , isRefinedMethod : Boolean ): SingleDenotation =
1133
+ if isRefinedMethod then
1134
+ new JointRefDenotation (s, i, validFor, pre, isRefinedMethod)
1135
+ else
1136
+ new UniqueRefDenotation (s, i, validFor, pre)
1131
1137
}
1132
1138
1133
1139
class JointRefDenotation (
1134
1140
symbol : Symbol ,
1135
1141
initInfo : Type ,
1136
1142
initValidFor : Period ,
1137
- prefix : Type ) extends NonSymSingleDenotation (symbol, initInfo, prefix) {
1143
+ prefix : Type ,
1144
+ override val isRefinedMethod : Boolean ) extends NonSymSingleDenotation (symbol, initInfo, prefix) {
1138
1145
validFor = initValidFor
1139
1146
override def hasUniqueSym : Boolean = false
1140
- protected def newLikeThis (s : Symbol , i : Type , pre : Type ): SingleDenotation =
1141
- new JointRefDenotation (s, i, validFor, pre)
1147
+ protected def newLikeThis (s : Symbol , i : Type , pre : Type , isRefinedMethod : Boolean ): SingleDenotation =
1148
+ new JointRefDenotation (s, i, validFor, pre, isRefinedMethod )
1142
1149
}
1143
1150
1144
1151
class ErrorDenotation (using Context ) extends NonSymSingleDenotation (NoSymbol , NoType , NoType ) {
1145
1152
override def exists : Boolean = false
1146
1153
override def hasUniqueSym : Boolean = false
1147
1154
validFor = Period .allInRun(ctx.runId)
1148
- protected def newLikeThis (s : Symbol , i : Type , pre : Type ): SingleDenotation =
1155
+ protected def newLikeThis (s : Symbol , i : Type , pre : Type , isRefinedMethod : Boolean ): SingleDenotation =
1149
1156
this
1150
1157
}
1151
1158
0 commit comments