Skip to content

Commit a537ac1

Browse files
committed
Replace containsSig with matches.
containsSig still used param-only matching, which is incorrect in the new system, because different overloaded methods may have the same parameter signature.
1 parent 25431a9 commit a537ac1

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,6 @@ object Denotations {
474474
if (matches) this else NoDenotation
475475
}
476476

477-
def matches(other: SingleDenotation)(implicit ctx: Context): Boolean = {
478-
val d = signature.matchDegree(other.signature)
479-
d == Signature.FullMatch ||
480-
d >= Signature.ParamMatch && info.matches(other.info)
481-
}
482-
483477
// ------ Forming types -------------------------------------------
484478

485479
/** The TypeRef representing this type denotation at its original location. */
@@ -786,12 +780,15 @@ object Denotations {
786780
final def last = this
787781
final def toDenot(pre: Type)(implicit ctx: Context): Denotation = this
788782
final def containsSym(sym: Symbol): Boolean = hasUniqueSym && (symbol eq sym)
789-
final def containsSig(sig: Signature)(implicit ctx: Context) =
790-
exists && signature.matchDegree(sig) >= Signature.ParamMatch
783+
final def matches(other: SingleDenotation)(implicit ctx: Context): Boolean = {
784+
val d = signature.matchDegree(other.signature)
785+
d == Signature.FullMatch ||
786+
d >= Signature.ParamMatch && info.matches(other.info)
787+
}
791788
final def filterWithPredicate(p: SingleDenotation => Boolean): SingleDenotation =
792789
if (p(this)) this else NoDenotation
793790
final def filterDisjoint(denots: PreDenotation)(implicit ctx: Context): SingleDenotation =
794-
if (denots.exists && denots.containsSig(signature)) NoDenotation else this
791+
if (denots.exists && denots.matches(this)) NoDenotation else this
795792
def mapInherited(ownDenots: PreDenotation, prevDenots: PreDenotation, pre: Type)(implicit ctx: Context): SingleDenotation =
796793
if (hasUniqueSym && prevDenots.containsSym(symbol)) NoDenotation
797794
else if (isType) filterDisjoint(ownDenots).asSeenFrom(pre)
@@ -880,7 +877,7 @@ object Denotations {
880877
def containsSym(sym: Symbol): Boolean
881878

882879
/** Group contains a denotation with given signature */
883-
def containsSig(sig: Signature)(implicit ctx: Context): Boolean
880+
def matches(other: SingleDenotation)(implicit ctx: Context): Boolean
884881

885882
/** Keep only those denotations in this group which satisfy predicate `p`. */
886883
def filterWithPredicate(p: SingleDenotation => Boolean): PreDenotation
@@ -941,8 +938,8 @@ object Denotations {
941938
(denots1 toDenot pre) & (denots2 toDenot pre, pre)
942939
def containsSym(sym: Symbol) =
943940
(denots1 containsSym sym) || (denots2 containsSym sym)
944-
def containsSig(sig: Signature)(implicit ctx: Context) =
945-
(denots1 containsSig sig) || (denots2 containsSig sig)
941+
def matches(other: SingleDenotation)(implicit ctx: Context): Boolean =
942+
denots1.matches(other) || denots2.matches(other)
946943
def filterWithPredicate(p: SingleDenotation => Boolean): PreDenotation =
947944
derivedUnion(denots1 filterWithPredicate p, denots2 filterWithPredicate p)
948945
def filterDisjoint(denots: PreDenotation)(implicit ctx: Context): PreDenotation =

0 commit comments

Comments
 (0)