Skip to content

Commit eabe5e6

Browse files
committed
TODO: static forwarders
object Properties extends PropertiesTrait trait PropertiesTrait { // the protected member is not emitted as a static member of -- it works when dropping the access modifier // somehow, the module class member is considered deferred in BForwardersGen protected val propFilename: String = / } // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false // the following method is missing compared to scalac // public final class Properties { // public static String propFilename() { // return Properties$.MODULE$.propFilename(); // }
1 parent de4661d commit eabe5e6

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
632632

633633
for (m <- moduleClass.info.membersBasedOnFlags(bCodeAsmCommon.ExcludedForwarderFlags, symtab.Flags.METHOD)) {
634634
if (m.isType || m.isDeferred || (m.owner eq definitions.ObjectClass) || m.isConstructor)
635-
debuglog(s"No forwarder for '$m' from $jclassName to '$moduleClass'")
635+
debuglog(s"No forwarder for '$m' from $jclassName to '$moduleClass': ${m.isType} || ${m.isDeferred} || ${m.owner eq definitions.ObjectClass} || ${m.isConstructor}")
636636
else if (conflictingNames(m.name))
637637
log(s"No forwarder for $m due to conflict with ${linkedClass.info.member(m.name)}")
638638
else if (m.hasAccessBoundary)

src/compiler/scala/tools/nsc/transform/Fields.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,26 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
120120
// strict, memoized accessors will receive an implementation in first real class to extend this trait
121121
decls.foreach {
122122
case accessor if accessor hasFlag ACCESSOR =>
123-
// only affects private symbols, with a destructive update of their name, also sets flags
124-
// required for private vals in traits
125-
accessor.makeNotPrivate(clazz)
126-
127123
if (!(accessor hasFlag (DEFERRED | LAZY)) && fieldMemoizationIn(accessor, clazz).needsField) {
128124
// in a trait, a memoized accessor becomes deferred
129125
// (it'll receive an implementation in the first real class to extend this trait)
130126

131127
// can't mark getter as FINAL in trait, but remember for when we synthetisize the impl in the subclass to make it FINAL
132128
val finality = if (accessor hasFlag FINAL) FINAL_TRAIT_ACCESSOR else 0
133-
accessor setFlag (finality | lateFINAL | DEFERRED | SYNTHESIZE_IMPL_IN_SUBCLASS)
134-
135-
// trait members cannot be final (but the synthesized ones should be)
136-
// LOCAL no longer applies (already made not-private)
137-
accessor resetFlag (FINAL | LOCAL)
129+
accessor setFlag (finality | DEFERRED | SYNTHESIZE_IMPL_IN_SUBCLASS)
138130

139131
if ((accessor hasFlag STABLE) && accessor.isGetter) // TODO: isGetter is probably redundant?
140132
newSetters += newTraitSetter(accessor, clazz)
141133
}
142134

135+
// only affects private symbols, with a destructive update of their name, also sets flags
136+
// required for private vals in traits
137+
accessor.makeNotPrivate(clazz)
138+
139+
// trait members cannot be final (but the synthesized ones should be)
140+
// LOCAL no longer applies (already made not-private)
141+
accessor resetFlag (FINAL | LOCAL)
142+
143143
case _ =>
144144
}
145145

src/compiler/scala/tools/nsc/transform/LambdaLift.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ abstract class LambdaLift extends InfoTransform {
451451
// See neg/t1909-object.scala
452452
def msg = s"SI-1909 Unable to STATICally lift $sym, which is defined in the self- or super-constructor call of ${sym.owner.owner}. A VerifyError is likely."
453453
devWarning(tree.pos, msg)
454-
} else sym setFlag STATIC
454+
} else sym setFlag STATIC
455455
}
456456

457457
sym.owner = sym.owner.enclClass

0 commit comments

Comments
 (0)