diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-31 20:04:29 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-31 20:04:29 -0800 |
commit | 08596af059edd3f2343764ba6cd022d65ace5921 (patch) | |
tree | 7e3ed722e634a5b518ca13de6adf3701b36fabdf /src | |
parent | 644eb7078a11613a06dcaaefb807cbcc44f65ea7 (diff) | |
parent | 4b39be4b9ce9f93f210994906da814219a64fce1 (diff) | |
download | scala-08596af059edd3f2343764ba6cd022d65ace5921.tar.gz scala-08596af059edd3f2343764ba6cd022d65ace5921.tar.bz2 scala-08596af059edd3f2343764ba6cd022d65ace5921.zip |
Merge pull request #2036 from scalamacros/ticket/5716
[backport] the scanner is now less eager about deprecations
Diffstat (limited to 'src')
-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 4f564c5d0b..00d4d57b34 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala @@ -113,6 +113,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) @@ -122,7 +127,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") } } @@ -1488,6 +1493,10 @@ trait Scanners extends ScannersCommon { def improves(patches1: List[BracePatch]): Boolean = imbalanceMeasure > new ParensAnalyzer(unit, patches1).imbalanceMeasure + // 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) {} } } |