File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
src/reflect/scala/reflect/internal
test/junit/scala/reflect/internal Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1050,7 +1050,7 @@ trait Printers extends api.Printers { self: SymbolTable =>
1050
1050
x match {
1051
1051
case Constant (v : String ) if {
1052
1052
val strValue = x.stringValue
1053
- strValue.contains(LF ) && strValue.contains(" \"\"\" " ) && strValue.size > 1
1053
+ strValue.contains(LF ) && ! strValue.contains(" \"\"\" " ) && strValue.size > 1
1054
1054
} =>
1055
1055
val splitValue = x.stringValue.split(s " $LF" ).toList
1056
1056
val multilineStringValue = if (x.stringValue.endsWith(s " $LF" )) splitValue :+ " " else splitValue
Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ trait BasePrintTests {
86
86
87
87
@ Test def testConstantLong = assertTreeCode(Literal (Constant (42l )))(" 42L" )
88
88
89
+ @ Test def testConstantMultiline = assertTreeCode(Literal (Constant (" hello\n world" )))(" \"\"\" hello\n world\"\"\" " )
90
+
91
+ val sq = " \" "
92
+ val teq = " \\\" " * 3
93
+ val tq = " \" " * 3
94
+
95
+ @ Test def testConstantEmbeddedTriple = assertTreeCode(Literal (Constant (s " ${tq}hello ${tq}\n world " )))(s " ${sq}${teq}hello ${teq}\\ nworld ${sq}" )
96
+
89
97
@ Test def testOpExpr = assertPrintedCode(" (5).+(4)" , checkTypedTree = false )
90
98
91
99
@ Test def testName1 = assertPrintedCode(" class test" )
You can’t perform that action at this time.
0 commit comments