diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-08-10 14:51:34 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-08-14 22:04:43 +0200 |
commit | 1b5f73129fc2f678d00905e5d851536251f8821a (patch) | |
tree | b512c8ac4576f91b0420d7f55d8da643dfcc60c3 /test/files/neg/compile-time-only-a.scala | |
parent | 4c62f7db6f3913eedd92d85daf8f631149cc97b2 (diff) | |
download | scala-1b5f73129fc2f678d00905e5d851536251f8821a.tar.gz scala-1b5f73129fc2f678d00905e5d851536251f8821a.tar.bz2 scala-1b5f73129fc2f678d00905e5d851536251f8821a.zip |
moves compileTimeOnly to scala-library
This is the notion that's come to be universally useful, so I suggest
we promote it to be universally accessible.
Note that the attached test incorrectly fails to report errors for
definitions coming from the empty package and for annotations. These
are bugs, and they are fixed in subsequent commits of this pull request.
Diffstat (limited to 'test/files/neg/compile-time-only-a.scala')
-rw-r--r-- | test/files/neg/compile-time-only-a.scala | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/files/neg/compile-time-only-a.scala b/test/files/neg/compile-time-only-a.scala new file mode 100644 index 0000000000..43d36dfab1 --- /dev/null +++ b/test/files/neg/compile-time-only-a.scala @@ -0,0 +1,57 @@ +import scala.annotation.compileTimeOnly + +@compileTimeOnly("C1") class C1 +object C1 + +class C2 +@compileTimeOnly("C2") object C2 + +@compileTimeOnly("C3") case class C3(x: Int) + +@compileTimeOnly("C4") case class C4(x: Int) +object C4 + +object pkg { + @compileTimeOnly("C5") + implicit class C5(val x: Int) { + def ext = ??? + } +} + +class C6(@compileTimeOnly("C6.x") val x: Int) { + @compileTimeOnly("C6.foo") def foo = 2 + @compileTimeOnly("C6.Foo") type Foo = Int + @compileTimeOnly("C6.y") var y = 3 +} + +object Test extends App { + new C1() + C1 + + new C2() + C2 + + new C3(2) + C3(2) + + new C4(2) + C4(2) + + import pkg._ + 2.ext + C5(2) + + val c6 = new C6(2) + val _ = c6.x + c6.foo + type Foo = c6.Foo + c6.y = c6.y +} + +@compileTimeOnly("placebo") +class placebo extends scala.annotation.StaticAnnotation + +@placebo +class Test { + @placebo def x = (2: @placebo) +}
\ No newline at end of file |