@@ -1096,41 +1096,53 @@ trait Types
10961096 val flags = sym.flags
10971097 if ((flags & required) == required) {
10981098 val excl = flags & excluded
1099- if (excl == 0L &&
1100- (
1101- (bcs eq bcs0) ||
1102- (flags & PrivateLocal ) != PrivateLocal ||
1103- admitPrivateLocal(bcs.head))) {
1099+ val isMember = (
1100+ excl == 0L
1101+ && ( (bcs eq bcs0)
1102+ || (flags & PrivateLocal ) != PrivateLocal
1103+ || admitPrivateLocal(bcs.head)
1104+ )
1105+ )
1106+ if (isMember) {
11041107 if (name.isTypeName || (stableOnly && sym.isStable && ! sym.hasVolatileType)) {
11051108 if (Statistics .canEnable) Statistics .popTimer(typeOpsStack, start)
11061109 return sym
1107- } else if (member eq NoSymbol ) {
1110+ } else if (member eq NoSymbol ) { // The first found member
11081111 member = sym
1109- } else if (members eq null ) {
1110- if ((member ne sym) &&
1111- ((member.owner eq sym.owner) ||
1112- (flags & PRIVATE ) != 0 || {
1113- if (self eq null ) self = narrowForFindMember(this )
1114- if (membertpe eq null ) membertpe = self.memberType(member)
1115- ! (membertpe matches self.memberType(sym))
1116- })) {
1112+ } else if (members eq null ) { // Already found one member
1113+ @ inline def computeSelfAndMemberType () = {
1114+ if (self eq null ) self = narrowForFindMember(this )
1115+ if (membertpe eq null ) membertpe = self.memberType(member)
1116+ }
1117+ val isNewMember = ( (member ne sym)
1118+ && ( (member.owner eq sym.owner)
1119+ || (flags & PRIVATE ) != 0
1120+ || { computeSelfAndMemberType(); ! (membertpe matches self.memberType(sym))}
1121+ )
1122+ )
1123+
1124+ if (isNewMember) {
11171125 lastM = new :: (sym, null )
11181126 members = member :: lastM
11191127 }
1120- } else {
1128+ } else { // Already found 2 or more members
11211129 var others : List [Symbol ] = members
11221130 var symtpe : Type = null
1123- while ((others ne null ) && {
1124- val other = others.head
1125- (other ne sym) &&
1126- ((other.owner eq sym.owner) ||
1127- (flags & PRIVATE ) != 0 || {
1128- if (self eq null ) self = narrowForFindMember(this )
1129- if (symtpe eq null ) symtpe = self.memberType(sym)
1130- ! (self.memberType(other) matches symtpe)
1131- })}) {
1132- others = others.tail
1131+ @ inline def computeSelfAndSymtpe () = {
1132+ if (self eq null ) self = narrowForFindMember(this )
1133+ if (symtpe eq null ) symtpe = self.memberType(sym)
11331134 }
1135+ while ( (others ne null )
1136+ && {
1137+ val other = others.head
1138+ ( (other ne sym)
1139+ && ( (other.owner eq sym.owner)
1140+ || (flags & PRIVATE ) != 0
1141+ || { computeSelfAndSymtpe(); ! (self.memberType(other) matches symtpe)}
1142+ )
1143+ )
1144+ }
1145+ ) others = others.tail
11341146 if (others eq null ) {
11351147 val lastM1 = new :: (sym, null )
11361148 lastM.tl = lastM1
0 commit comments