From 65961a939b8ede59ab2cb73f658e49ab4cc430ad Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Mon, 7 Mar 2016 17:52:16 +0100 Subject: Add test that was used to see if @static works. --- tests/run/statics.scala | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/run/statics.scala (limited to 'tests/run/statics.scala') 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 +} -- cgit v1.2.3