We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ebe6f1c commit 07d2bb6Copy full SHA for 07d2bb6
library/src/dotty/Show.scala
@@ -27,6 +27,8 @@ object Show extends LowPrioShow {
27
* @return a string describing how to escape the give char in source code.
28
*/
29
private def escapeChar(c: Char): String = c match {
30
+ // From 2.12 spec, `charEscapeSeq`:
31
+ // ‘\‘ (‘b‘ | ‘t‘ | ‘n‘ | ‘f‘ | ‘r‘ | ‘"‘ | ‘'‘ | ‘\‘)
32
case '\b' => "\\b"
33
case '\t' => "\\t"
34
case '\n' => "\\n"
@@ -39,8 +41,6 @@ object Show extends LowPrioShow {
39
41
}
40
42
43
implicit val stringShow: Show[String] = new Show[String] {
- // From 2.12 spec, `charEscapeSeq`:
- // ‘\‘ (‘b‘ | ‘t‘ | ‘n‘ | ‘f‘ | ‘r‘ | ‘"‘ | ‘'‘ | ‘\‘)
44
def show(str: String) = str.flatMap(escapeChar).mkString("\"", "", "\"")
45
46
0 commit comments