Skip to content

Commit a3b417b

Browse files
authored
Merge pull request #9148 from dotty-staging/remove-match-slowpath
Denotation#matches: avoid now-unnecessary slow path
2 parents defcea3 + 13ea0c0 commit a3b417b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

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

+3-8
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)