diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-12-30 18:31:41 -0800 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-12-30 18:31:41 -0800 |
commit | 2b3c6606a637746c14785f4de0829d9a9598e899 (patch) | |
tree | 9ba95786cac5be5e92cdce667eb69c50e1327027 /src/compiler | |
parent | 93f3d63d67b0b1e81322b67488b80ee0a34d74e6 (diff) | |
parent | 2015ad3ebd833225e93ed19604760a6da2522bb1 (diff) | |
download | scala-2b3c6606a637746c14785f4de0829d9a9598e899.tar.gz scala-2b3c6606a637746c14785f4de0829d9a9598e899.tar.bz2 scala-2b3c6606a637746c14785f4de0829d9a9598e899.zip |
Merge pull request #1807 from scalamacros/topic/ident-deprecation-warnings
the scanner is now less eager about deprecations
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Scanners.scala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala index af7f48988f..3025e4c440 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala @@ -104,6 +104,11 @@ trait Scanners extends ScannersCommon { cbuf.append(c) } + /** Determines whether this scanner should emit identifier deprecation warnings, + * e.g. when seeing `macro` or `then`, which are planned to become keywords in future versions of Scala. + */ + protected def emitIdentifierDeprecationWarnings = true + /** Clear buffer and set name and token */ private def finishNamed(idtoken: Int = IDENTIFIER) { name = newTermName(cbuf.toString) @@ -113,7 +118,7 @@ trait Scanners extends ScannersCommon { val idx = name.start - kwOffset if (idx >= 0 && idx < kwArray.length) { token = kwArray(idx) - if (token == IDENTIFIER && allowIdent != name) + if (token == IDENTIFIER && allowIdent != name && emitIdentifierDeprecationWarnings) deprecationWarning(name+" is now a reserved word; usage as an identifier is deprecated") } } @@ -1461,6 +1466,10 @@ trait Scanners extends ScannersCommon { delete(bracePairs) } + // don't emit deprecation warnings about identifiers like `macro` or `then` + // when skimming through the source file trying to heal braces + override def emitIdentifierDeprecationWarnings = false + override def error(offset: Int, msg: String) {} } } |