aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-03-09 10:11:06 +0100
committerodersky <odersky@gmail.com>2016-03-09 10:11:06 +0100
commitbdd8c35447aa92969abf1dbaf479b6995fdfb7f4 (patch)
tree6bfe354499401aedee84b3677ea98259d1731b29 /tests
parent560810e25c77a5efd6212b71f29d2626aa21e9af (diff)
parenta068498201e7223f35e8801055645bd5b339ce67 (diff)
downloaddotty-bdd8c35447aa92969abf1dbaf479b6995fdfb7f4.tar.gz
dotty-bdd8c35447aa92969abf1dbaf479b6995fdfb7f4.tar.bz2
dotty-bdd8c35447aa92969abf1dbaf479b6995fdfb7f4.zip
Merge pull request #1155 from dotty-staging/static
Implement @static sip.
Diffstat (limited to 'tests')
-rw-r--r--tests/run/statics.scala40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/run/statics.scala b/tests/run/statics.scala
new file mode 100644
index 000000000..8425e7f77
--- /dev/null
+++ b/tests/run/statics.scala
@@ -0,0 +1,40 @@
+import scala.annotation.static
+
+class Foo{
+ class Bar {
+ def qwa =
+ Bar.field
+ // 0: invokestatic #31 // Method Foo$Bar$.field:()I
+ // 3: ireturn
+ }
+ object Bar {
+ @static
+ val field = 1
+ }
+}
+
+object Foo{
+ @static
+ def method = 1
+
+ @static
+ val field = 2
+
+ @static
+ var mutable = 3
+
+ @static
+ def accessor = field
+}
+
+object Test {
+ import Foo._
+ def main(args: Array[String]): Unit = {
+ method + field + mutable + accessor
+ }
+}
+
+class WithLazies{
+ @volatile lazy val s = 1
+ // 98: getstatic #30 // Field WithLazies$.OFFSET$0:J
+}