summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-09-14 10:45:43 +0200
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-09-17 20:26:08 +0200
commit6b9e1a0747159128da1e84795c1be6698e16ee43 (patch)
tree78922e7ef36a25cbdd473f2f5e44986ed9727a36
parent6854842cf88f020289b783983d13ebef4d7605f4 (diff)
downloadscala-6b9e1a0747159128da1e84795c1be6698e16ee43.tar.gz
scala-6b9e1a0747159128da1e84795c1be6698e16ee43.tar.bz2
scala-6b9e1a0747159128da1e84795c1be6698e16ee43.zip
Revert "Fixes SI-6189."
This reverts commit 5a8dfad583b825158cf0abdae5d73a4a7f8cd997. Conflicts: src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala10
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala1
-rw-r--r--test/files/neg/static-annot.scala6
-rw-r--r--test/files/run/static-annot-repl.check32
-rw-r--r--test/files/run/static-annot-repl.scala22
5 files changed, 3 insertions, 68 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
}
}
diff --git a/test/files/neg/static-annot.scala b/test/files/neg/static-annot.scala
index c0b5ed30d8..c6c626d42b 100644
--- a/test/files/neg/static-annot.scala
+++ b/test/files/neg/static-annot.scala
@@ -45,9 +45,3 @@ class PrivateProtectedLazy {
println(PrivateProtectedLazy.baz)
println(PrivateProtectedLazy.bam)
}
-
-
-class StaticDef {
- // this should not crash the compiler
- @static def x = 42
-}
diff --git a/test/files/run/static-annot-repl.check b/test/files/run/static-annot-repl.check
deleted file mode 100644
index d1029a9809..0000000000
--- a/test/files/run/static-annot-repl.check
+++ /dev/null
@@ -1,32 +0,0 @@
-Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> import annotation.static
-import annotation.static
-
-scala> @static var x1 = 42
-x1: Int = 42
-
-scala> @static val x2 = 43
-x2: Int = 43
-
-scala> @static def x3 = 44
-x3: Int
-
-scala> x1
-res0: Int = 42
-
-scala> x2
-res1: Int = 43
-
-scala> x3
-res2: Int = 44
-
-scala> class Test {
- @static def x = 42
-}
-defined class Test
-
-scala> \ No newline at end of file
diff --git a/test/files/run/static-annot-repl.scala b/test/files/run/static-annot-repl.scala
deleted file mode 100644
index 1d2e9b2d7e..0000000000
--- a/test/files/run/static-annot-repl.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-import scala.tools.partest.ReplTest
-
-
-
-object Test extends ReplTest {
- def code = """
-import annotation.static
-@static var x1 = 42
-@static val x2 = 43
-@static def x3 = 44
-x1
-x2
-x3
-class Test {
- @static def x = 42
-}
-"""
-
-}