Skip to content

Commit 13ea0c0

Browse files
committed
Denotation#matches: avoid now-unnecessary slow path
The slow path when matching on a PolyType was necessary when it was added in 668a637, but since then signatures were enhanced to also include the number of type parameters (in f951534), thus making the extra check unnecessary.
1 parent 7964d17 commit 13ea0c0

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -972,20 +972,15 @@ object Denotations {
972972
final def matches(other: SingleDenotation)(implicit ctx: Context): Boolean =
973973
val d = signature.matchDegree(other.signature)
974974

975-
/** Slower check used if the signatures alone do not tell us enough to be sure about matching */
976-
def slowCheck = info.matches(other.info)
977-
978975
d match
979976
case FullMatch =>
980-
if infoOrCompleter.isInstanceOf[PolyType] || other.infoOrCompleter.isInstanceOf[PolyType] then
981-
slowCheck
982-
else
983-
true
977+
true
984978
case MethodNotAMethodMatch =>
985979
// Java allows defining both a field and a zero-parameter method with the same name
986980
!ctx.erasedTypes && !(symbol.is(JavaDefined) && other.symbol.is(JavaDefined))
987981
case ParamMatch =>
988-
!ctx.erasedTypes && slowCheck
982+
// The signatures do not tell us enough to be sure about matching
983+
!ctx.erasedTypes && info.matches(other.info)
989984
case noMatch =>
990985
false
991986
end matches

0 commit comments

Comments
 (0)