diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-09-14 10:41:43 +0200 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-09-17 20:26:08 +0200 |
commit | 10c9cf05b415e39a004fcf983117668db73f46e1 (patch) | |
tree | 3868418e47bc40c1d61ff26a6509932a1dba395f | |
parent | 66603a2c003852d39faec20a9763fb0e25049cf4 (diff) | |
download | scala-10c9cf05b415e39a004fcf983117668db73f46e1.tar.gz scala-10c9cf05b415e39a004fcf983117668db73f46e1.tar.bz2 scala-10c9cf05b415e39a004fcf983117668db73f46e1.zip |
Revert "Fix SI-6294."
This reverts commit cb393fcbe35d0a871f23189d791b44be1b826ed2.
Conflicts:
src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t6294.scala | 14 |
2 files changed, 3 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index bab658e141..dcb90bef81 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -121,13 +121,11 @@ abstract class GenICode extends SubComponent { m.native = m.symbol.hasAnnotation(definitions.NativeAttr) if (!m.isAbstractMethod && !m.native) { - val staticfield = if (m.symbol.isAccessor && m.symbol.accessed.hasStaticAnnotation) { - val compClass = m.symbol.owner.companionClass - compClass.info.findMember(m.symbol.accessed.name, NoFlags, NoFlags, false) - } else NoSymbol - if (staticfield != NoSymbol) { + if (m.symbol.isAccessor && m.symbol.accessed.hasStaticAnnotation) { // in companion object accessors to @static fields, we access the static field directly val hostClass = m.symbol.owner.companionClass + val staticfield = hostClass.info.findMember(m.symbol.accessed.name, NoFlags, NoFlags, false) + if (m.symbol.isGetter) { ctx1.bb.emit(LOAD_FIELD(staticfield, true) setHostClass hostClass, tree.pos) ctx1.bb.closeWith(RETURN(m.returnType)) diff --git a/test/files/pos/t6294.scala b/test/files/pos/t6294.scala deleted file mode 100644 index c6d39a9cc8..0000000000 --- a/test/files/pos/t6294.scala +++ /dev/null @@ -1,14 +0,0 @@ - - - -object A { - @annotation.static final val x = 123 -} - - -object B { - println(A.x) -} - - - |