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 /src/library | |
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 'src/library')
-rw-r--r-- | src/library/scala/annotation/compileTimeOnly.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/library/scala/annotation/compileTimeOnly.scala b/src/library/scala/annotation/compileTimeOnly.scala new file mode 100644 index 0000000000..942e9cad8c --- /dev/null +++ b/src/library/scala/annotation/compileTimeOnly.scala @@ -0,0 +1,22 @@ +package scala.annotation + +import scala.annotation.meta._ + +/** + * An annotation that designates that an annottee should not be referred to after + * type checking (which includes macro expansion). + * + * Examples of potential use: + * 1) The annottee can only appear in the arguments of some other macro + * that will eliminate it from the AST during expansion. + * 2) The annottee is a macro and should have been expanded away, + * so if hasn't, something wrong has happened. + * (Comes in handy to provide better support for new macro flavors, + * e.g. macro annotations, that can't be expanded by the vanilla compiler). + * + * @param message the error message to print during compilation if a reference remains + * after type checking + * @since 2.11.0 + */ +@getter @setter @beanGetter @beanSetter @companionClass @companionMethod +final class compileTimeOnly(message: String) extends scala.annotation.StaticAnnotation |