diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-06 22:23:09 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-06 22:31:50 +0100 |
commit | 6902da3168c02448387edc000dedfe97ef5f7cd9 (patch) | |
tree | 4110e85872ce34f79c73bef7e5b6a2e3130b0a8f /src/compiler | |
parent | 3b68b45a200087104a1ac2de7c4b86635023fd4d (diff) | |
download | scala-6902da3168c02448387edc000dedfe97ef5f7cd9.tar.gz scala-6902da3168c02448387edc000dedfe97ef5f7cd9.tar.bz2 scala-6902da3168c02448387edc000dedfe97ef5f7cd9.zip |
SI-6539 Annotation for methods unfit for post-typer ASTs
Motivated by the `.value` method in the SBT task-syntax branch,
which should only be called within the context of the argument
to a setting initialization macro.
The facility is akin to a fatal deprecation.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index c1dc91dbfc..726c8d3b24 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1376,6 +1376,11 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans ) } + private def checkCompileTimeOnly(sym: Symbol, pos: Position) = { + if (sym.isCompileTimeOnly) + unit.error(pos, s"reference to ${sym.fullLocationString} should not survive typechecking: ${sym.compileTimeOnlyMessage.get}") + } + private def lessAccessible(otherSym: Symbol, memberSym: Symbol): Boolean = ( (otherSym != NoSymbol) && !otherSym.isProtected @@ -1562,6 +1567,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans checkDeprecated(sym, tree.pos) if (settings.Xmigration28.value) checkMigration(sym, tree.pos) + checkCompileTimeOnly(sym, tree.pos) if (sym eq NoSymbol) { unit.warning(tree.pos, "Select node has NoSymbol! " + tree + " / " + tree.tpe) |