summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2014-02-28 12:03:09 -0800
committerSom Snytt <som.snytt@gmail.com>2014-02-28 12:13:33 -0800
commit953b776d49d7de55a74967f6a48beea763d22144 (patch)
tree7d2feb53e7a11fdc8c91bfdcaac3ff24bda899e1
parentfabc9f1424824975943241b9bb2c9b7669f805bd (diff)
downloadscala-953b776d49d7de55a74967f6a48beea763d22144.tar.gz
scala-953b776d49d7de55a74967f6a48beea763d22144.tar.bz2
scala-953b776d49d7de55a74967f6a48beea763d22144.zip
SI-8266 Amend advice for deprecated octal 042
Improve the advice for `f"\042"` to read: ``` use ${'"'} or a triple-quoted literal """with embedded " or \u0022""" instead. ``` as per the discussion on SI-6476. Knuth says that Charles XII came close to introducing octal arithmetic to Sweden, and Wikipedia doesn't deny it. I imagine an alternative history in which octal literals are deprecated in Scala but required by legislation in Akka. #octal-fan-fiction
-rw-r--r--src/compiler/scala/tools/reflect/FormatInterpolator.scala3
-rw-r--r--test/files/run/t8266-octal-interp.check2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/reflect/FormatInterpolator.scala b/src/compiler/scala/tools/reflect/FormatInterpolator.scala
index 0258002850..e0f9bb6044 100644
--- a/src/compiler/scala/tools/reflect/FormatInterpolator.scala
+++ b/src/compiler/scala/tools/reflect/FormatInterpolator.scala
@@ -93,7 +93,8 @@ abstract class FormatInterpolator {
case '\n' => "\\n"
case '\f' => "\\f"
case '\r' => "\\r"
- case '\"' => "\\u0022" // $" in future
+ case '\"' => "${'\"'}" /* avoid lint warn */ +
+ " or a triple-quoted literal \"\"\"with embedded \" or \\u0022\"\"\"" // $" in future
case '\'' => "'"
case '\\' => """\\"""
case x => "\\u%04x" format x
diff --git a/test/files/run/t8266-octal-interp.check b/test/files/run/t8266-octal-interp.check
index 6e9454119b..66ecafddc2 100644
--- a/test/files/run/t8266-octal-interp.check
+++ b/test/files/run/t8266-octal-interp.check
@@ -10,7 +10,7 @@ t8266-octal-interp.scala:6: warning: Octal escape literals are deprecated, use \
t8266-octal-interp.scala:7: warning: Octal escape literals are deprecated, use \r instead.
f"a\15c",
^
-t8266-octal-interp.scala:8: warning: Octal escape literals are deprecated, use \u0022 instead.
+t8266-octal-interp.scala:8: warning: Octal escape literals are deprecated, use ${'"'} or a triple-quoted literal """with embedded " or \u0022""" instead.
f"a\42c",
^
t8266-octal-interp.scala:9: warning: Octal escape literals are deprecated, use \\ instead.