summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/reflect/FormatInterpolator.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/tools/reflect/FormatInterpolator.scala')
-rw-r--r--src/compiler/scala/tools/reflect/FormatInterpolator.scala13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/reflect/FormatInterpolator.scala b/src/compiler/scala/tools/reflect/FormatInterpolator.scala
index b445f1e2bb..857b733f59 100644
--- a/src/compiler/scala/tools/reflect/FormatInterpolator.scala
+++ b/src/compiler/scala/tools/reflect/FormatInterpolator.scala
@@ -6,7 +6,7 @@ import scala.reflect.internal.util.Position
import scala.PartialFunction.cond
import scala.util.matching.Regex.Match
-import java.util.{ Formatter, Formattable, IllegalFormatException }
+import java.util.Formattable
abstract class FormatInterpolator {
val c: Context
@@ -19,7 +19,6 @@ abstract class FormatInterpolator {
@inline private def truly(body: => Unit): Boolean = { body ; true }
@inline private def falsely(body: => Unit): Boolean = { body ; false }
- private def fail(msg: String) = c.abort(c.enclosingPosition, msg)
private def bail(msg: String) = global.abort(msg)
def interpolate: Tree = c.macroApplication match {
@@ -93,8 +92,8 @@ abstract class FormatInterpolator {
case '\n' => "\\n"
case '\f' => "\\f"
case '\r' => "\\r"
- case '\"' => "${'\"'}" /* avoid lint warn */ +
- " or a triple-quoted literal \"\"\"with embedded \" or \\u0022\"\"\"" // $" in future
+ case '\"' => "$" /* avoid lint warn */ +
+ "{'\"'} or a triple-quoted literal \"\"\"with embedded \" or \\u0022\"\"\""
case '\'' => "'"
case '\\' => """\\"""
case x => "\\u%04x" format x
@@ -117,7 +116,7 @@ abstract class FormatInterpolator {
c.error(errPoint, msg("unsupported"))
s0
} else {
- currentRun.reporting.deprecationWarning(errPoint, msg("deprecated"))
+ currentRun.reporting.deprecationWarning(errPoint, msg("deprecated"), "2.11.0")
try StringContext.treatEscapes(s0) catch escapeHatch
}
}
@@ -262,7 +261,7 @@ abstract class FormatInterpolator {
def goodFlags = {
val badFlags = flags map (_ filterNot (okFlags contains _))
for (bf <- badFlags; f <- bf) badFlag(f, s"Illegal flag '$f'")
- badFlags.getOrElse("").isEmpty
+ badFlags.getOrElse("").isEmpty
}
def goodIndex = {
if (index.nonEmpty && hasFlag('<'))
@@ -281,7 +280,7 @@ abstract class FormatInterpolator {
) orElse Some(variants(0))
}
object Conversion {
- import SpecifierGroups.{ Spec, CC, Width }
+ import SpecifierGroups.{ Spec, CC }
def apply(m: Match, p: Position, n: Int): Option[Conversion] = {
def badCC(msg: String) = {
val dk = new ErrorXn(m, p)