Skip to content

Commit 65961a9

Browse files
committed
Add test that was used to see if @static works.
1 parent 976702a commit 65961a9

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/run/statics.scala

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import scala.annotation.static
2+
3+
class Foo{
4+
class Bar {
5+
def qwa =
6+
Bar.field
7+
// 0: invokestatic #31 // Method Foo$Bar$.field:()I
8+
// 3: ireturn
9+
}
10+
object Bar {
11+
@static
12+
val field = 1
13+
}
14+
}
15+
16+
object Foo{
17+
@static
18+
def method = 1
19+
20+
@static
21+
val field = 2
22+
23+
@static
24+
var mutable = 3
25+
26+
@static
27+
def accessor = field
28+
}
29+
30+
object Test {
31+
import Foo._
32+
def main(args: Array[String]): Unit = {
33+
method + field + mutable + accessor
34+
}
35+
}
36+
37+
class WithLazies{
38+
@volatile lazy val s = 1
39+
// 98: getstatic #30 // Field WithLazies$.OFFSET$0:J
40+
}

0 commit comments

Comments
 (0)