diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-11-14 02:48:27 -0800 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-11-14 02:48:27 -0800 |
commit | 850108886765e99e894f7613f49c1bab3650a0c2 (patch) | |
tree | 8e8408aeae09a8db78f0a70d0ad9c425c23e80d2 /src/compiler | |
parent | ace401c8084f94a5ca5c38f3a10c5eee18b65645 (diff) | |
parent | 48ee29aa26e4e5358cb1de7890565095420177b4 (diff) | |
download | scala-850108886765e99e894f7613f49c1bab3650a0c2.tar.gz scala-850108886765e99e894f7613f49c1bab3650a0c2.tar.bz2 scala-850108886765e99e894f7613f49c1bab3650a0c2.zip |
Merge pull request #1585 from retronym/ticket/6539-2
SI-6539 Annotation for methods unfit for post-typer ASTs
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 11 |
1 files changed, 11 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..ee7805cb3d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1376,6 +1376,16 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans ) } + private def checkCompileTimeOnly(sym: Symbol, pos: Position) = { + if (sym.isCompileTimeOnly) { + def defaultMsg = + s"""|Reference to ${sym.fullLocationString} should not have survived past type checking, + |it should have been processed and eliminated during expansion of an enclosing macro.""".stripMargin + // The getOrElse part should never happen, it's just here as a backstop. + unit.error(pos, sym.compileTimeOnlyMessage getOrElse defaultMsg) + } + } + private def lessAccessible(otherSym: Symbol, memberSym: Symbol): Boolean = ( (otherSym != NoSymbol) && !otherSym.isProtected @@ -1562,6 +1572,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) |