diff options
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/static-implements.scala | 11 | ||||
-rw-r--r-- | tests/neg/static-no-companion.scala | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/neg/static-implements.scala b/tests/neg/static-implements.scala new file mode 100644 index 000000000..8e8a8800c --- /dev/null +++ b/tests/neg/static-implements.scala @@ -0,0 +1,11 @@ +import annotation.static + +abstract class A { def x: Int } + +class T +object T extends A { + @static override val x = 10 // error: static methods cannot implement stuff + def main(args: Array[String]): Unit = { + println((this: A).x) + } +} diff --git a/tests/neg/static-no-companion.scala b/tests/neg/static-no-companion.scala new file mode 100644 index 000000000..982dddf88 --- /dev/null +++ b/tests/neg/static-no-companion.scala @@ -0,0 +1,4 @@ +import annotation.static +object T { + @static val foo = 10 // error: needs companion class +} |