aboutsummaryrefslogtreecommitdiff
path: root/tests/run/statics.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2016-03-07 17:52:16 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2016-03-07 17:52:56 +0100
commit65961a939b8ede59ab2cb73f658e49ab4cc430ad (patch)
treecc23ea8ab1634477003fffc4e294fc85d7ccb8e4 /tests/run/statics.scala
parent976702a074e145b10125c1285affd69238d5a8e7 (diff)
downloaddotty-65961a939b8ede59ab2cb73f658e49ab4cc430ad.tar.gz
dotty-65961a939b8ede59ab2cb73f658e49ab4cc430ad.tar.bz2
dotty-65961a939b8ede59ab2cb73f658e49ab4cc430ad.zip
Add test that was used to see if @static works.
Diffstat (limited to 'tests/run/statics.scala')
-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
+}