@@ -43,29 +43,18 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
43
43
* methods in the impl class (because they can have arbitrary initializers)
44
44
*/
45
45
private def isImplementedStatically (sym : Symbol ) = (
46
- erasure.isInterfaceMember( sym)
47
- && erasure.needsImplMethod( sym)
46
+ sym.isMethod
47
+ && ( ! sym.hasFlag( DEFERRED | SUPERACCESSOR ) || ( sym hasFlag lateDEFERRED) )
48
48
&& sym.owner.isTrait
49
49
&& sym.isMethod
50
50
&& (! sym.isModule || sym.hasFlag(PRIVATE | LIFTED ))
51
51
&& (! (sym hasFlag (ACCESSOR | SUPERACCESSOR )) || sym.isLazy)
52
+ && ! sym.isPrivate
53
+ && ! sym.hasAllFlags(LIFTED | MODULE | METHOD )
54
+ && ! sym.isConstructor
55
+ && (! sym.hasFlag(notPRIVATE | LIFTED ) || sym.hasFlag(ACCESSOR | SUPERACCESSOR | MODULE ))
52
56
)
53
57
54
- /** A member of a trait is static only if it belongs only to the
55
- * implementation class, not the interface, and it is implemented
56
- * statically.
57
- */
58
- private def isStaticOnly (sym : Symbol ) =
59
- isImplementedStatically(sym) && sym.isImplOnly
60
-
61
- /** A member of a trait is forwarded if it is implemented statically and it
62
- * is also visible in the trait's interface. In that case, a forwarder to
63
- * the member's static implementation will be added to the class that
64
- * inherits the trait.
65
- */
66
- private def isForwarded (sym : Symbol ) =
67
- isImplementedStatically(sym) && ! sym.isImplOnly
68
-
69
58
private def isFieldWithBitmap (field : Symbol ) = {
70
59
field.info // ensure that nested objects are transformed
71
60
// For checkinit consider normal value getters
@@ -247,7 +236,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
247
236
248
237
/* Mix in members of implementation class mixinClass into class clazz */
249
238
def mixinTraitForwarders (mixinClass : Symbol ) {
250
- for (member <- mixinClass.info.decls ; if isForwarded (member)) {
239
+ for (member <- mixinClass.info.decls ; if isImplementedStatically (member)) {
251
240
member overridingSymbol clazz match {
252
241
case NoSymbol =>
253
242
if (clazz.info.findMember(member.name, 0 , 0L , stableOnly = false ).alternatives contains member)
@@ -484,7 +473,8 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
484
473
* - A super accessor for every super accessor in a mixin class
485
474
* - Forwarders for all methods that are implemented statically
486
475
* All superaccessors are completed with right-hand sides (@see completeSuperAccessor)
487
- * @param clazz The class to which definitions are added
476
+ *
477
+ * @param clazz The class to which definitions are added
488
478
*/
489
479
private def addNewDefs (clazz : Symbol , stats : List [Tree ]): List [Tree ] = {
490
480
val newDefs = mutable.ListBuffer [Tree ]()
0 commit comments