Closed
Description
As findMember
walks up the base class sequence, it records the direct parent symbols of the first encounted refinement class.
// SLS 5.2 The private modifier can be used with any definition or declaration in a template.
// They are not inherited by subclasses [...]
if (currentBaseClass.isRefinementClass)
// SLS 3.2.7 A compound type T1 with . . . with Tn {R } represents objects with members as given in
// the component types T1, ..., Tn and the refinement {R }
//
// => private members should be included from T1, ... Tn. (scala/bug#7475)
refinementParents :::= currentBaseClass.parentSymbols
This list is later used to deal with a corner case (whether a private member should be inherited or not)
def admitPrivate(sym: Symbol): Boolean =
(selectorClass == owner) || (
!isPrivateLocal // private[this] only a member from within the selector class. (Optimization only? Does the spec back this up?)
&& (
!seenFirstNonRefinementClass
|| refinementParents.contains(owner)
)
)
This call to parentSymbols
accounts for 1.5% of allocated ::
instances. We should refactor this code to defer the until we actually end up dealing with this corner case.