summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2015-01-31 15:55:35 -0800
committerSom Snytt <som.snytt@gmail.com>2015-02-21 17:12:44 -0800
commitdcd4d6700660c480b29eb4c8aeba77403c112d5f (patch)
tree84ee94186fee57d20df4a240e7459f6bf2b9df80 /src/compiler
parent3a32ae3651f69237bde32598674bc135ad9e4064 (diff)
downloadscala-dcd4d6700660c480b29eb4c8aeba77403c112d5f.tar.gz
scala-dcd4d6700660c480b29eb4c8aeba77403c112d5f.tar.bz2
scala-dcd4d6700660c480b29eb4c8aeba77403c112d5f.zip
SI-9127 Xlint doesn't think spaces are significant
For purposes of warning about missing interpolators, such as `"$greeting"` when the intended code was `s"$greeting"`, spaces are no longer significant. The heuristic was previously intended to allow compileresque strings, where the dollar sign is a common prefix. Currently, the Xlint warning can be selectively disabled.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 3a85d16f55..8efef8b4aa 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -5200,13 +5200,10 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
def suspiciousExpr = InterpolatorCodeRegex findFirstIn s
def suspiciousIdents = InterpolatorIdentRegex findAllIn s map (s => suspiciousSym(s drop 1))
- // heuristics - no warning on e.g. a string with only "$asInstanceOf"
- if (s contains ' ') (
- if (suspiciousExpr.nonEmpty)
- warn("detected an interpolated expression") // "${...}"
- else
- suspiciousIdents find isPlausible foreach (sym => warn(s"detected interpolated identifier `$$${sym.name}`")) // "$id"
- )
+ if (suspiciousExpr.nonEmpty)
+ warn("detected an interpolated expression") // "${...}"
+ else
+ suspiciousIdents find isPlausible foreach (sym => warn(s"detected interpolated identifier `$$${sym.name}`")) // "$id"
}
lit match {
case Literal(Constant(s: String)) if !isRecognizablyNotForInterpolation => maybeWarn(s)