diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 10 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/CleanUp.scala | 1 |
2 files changed, 3 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 0bccd5fe0e..697c2bf23b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -900,17 +900,13 @@ abstract class GenICode extends SubComponent { case app @ Apply(fun @ Select(qual, _), args) if !ctx.method.symbol.isStaticConstructor - && fun.symbol.isAccessor && fun.symbol.accessed.hasStaticAnnotation - && qual.tpe.typeSymbol.orElse(fun.symbol.owner).companionClass != NoSymbol => + && fun.symbol.isAccessor && fun.symbol.accessed.hasStaticAnnotation => // bypass the accessor to the companion object and load the static field directly - // this bypass is not done: - // - if the static intializer for the static field itself - // - if there is no companion class of the object owner - this happens in the REPL + // the only place were this bypass is not done, is the static intializer for the static field itself def genLoadApply5 = { val sym = fun.symbol generatedType = toTypeKind(sym.accessed.info) - val hostOwner = qual.tpe.typeSymbol.orElse(sym.owner) - val hostClass = hostOwner.companionClass + val hostClass = qual.tpe.typeSymbol.orElse(sym.owner).companionClass val staticfield = hostClass.info.findMember(sym.accessed.name, NoFlags, NoFlags, false) if (sym.isGetter) { diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index 62a0c78c5c..a705e85310 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -783,7 +783,6 @@ abstract class CleanUp extends Transform with ast.TreeDSL { // add field definition to new defs newStaticMembers append stfieldDef newStaticInits append stfieldInit - case _ => // ignore @static on other members } } |