8000 Rework changes to specializedSym · scala/scala@9b28b01 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b28b01

Browse files
committed
Rework changes to specializedSym
Restrict the fast path to term symbols (which is the important case for performance) to allow the existing code to handle type symbols.
1 parent 1517573 commit 9b28b01

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/reflect/scala/reflect/internal/Types.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4258,9 +4258,9 @@ trait Types
42584258
protected[internal] def specializesSym(preLo: Type, symLo: Symbol, preHi: Type, symHi: Symbol, depth: Depth): Boolean =
42594259
(symHi.isAliasType || symHi.isTerm || symHi.isAbstractType) && {
42604260
val symHiInfo = symHi.info
4261-
if (symHiInfo == WildcardType) {
4262-
if (symHi.isTerm) (!symHi.isStable || symLo.isStable) // sub-member must remain stable
4263-
else true
4261+
if (symHi.isTerm && symHiInfo == WildcardType) {
4262+
// OPT fast path (avoiding tpLo.mmeberType) for wildcards which appear here frequently in the search for implicit views.
4263+
!symHi.isStable || symLo.isStable // sub-member must remain stable
42644264
} else {
42654265
// only now that we know symHi is a viable candidate, do the expensive checks: ----V
42664266
require((symLo ne NoSymbol) && (symHi ne NoSymbol), ((preLo, symLo, preHi, symHi, depth)))

0 commit comments

Comments
 (0)
0