Skip to content

Commit 6de4253

Browse files
Merge pull request #3616 from dotty-staging/fix-#3614
Fix #3614: Do not allow the SyntaxFormatter to recolor code
2 parents 25e53b0 + 450c0d8 commit 6de4253

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

compiler/src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ object Formatting {
7979
class SyntaxFormatter(sc: StringContext) extends StringFormatter(sc) {
8080
override protected def showArg(arg: Any)(implicit ctx: Context): String =
8181
arg match {
82-
case arg: Showable if ctx.settings.color.value != "never" =>
83-
val highlighted =
84-
SyntaxHighlighting(wrapNonSensical(arg, super.showArg(arg)))
85-
new String(highlighted.toArray)
8682
case hl: Highlight =>
8783
hl.show
8884
case hb: HighlightBuffer =>

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ object messages {
744744
val msg =
745745
hl"""|${NoColor(msgPrefix)} type arguments for $prettyName$expectedArgString
746746
|expected: $expectedArgString
747-
|actual: $actualArgString""".stripMargin
747+
|actual: ${NoColor(actualArgString)}""".stripMargin
748748

749749
val explanation = {
750750
val tooManyTypeParams =
@@ -1433,11 +1433,11 @@ object messages {
14331433
val msg = hl"$tpe does not take type parameters"
14341434

14351435
private val ps =
1436-
if (params.size == 1) hl"a type parameter ${params.head}"
1437-
else hl"type parameters ${params.map(_.show).mkString(", ")}"
1436+
if (params.size == 1) s"a type parameter ${params.head}"
1437+
else s"type parameters ${params.map(_.show).mkString(", ")}"
14381438

14391439
val explanation =
1440-
i"""You specified $ps for ${hl"$tpe"}, which is not
1440+
i"""You specified ${NoColor(ps)} for ${hl"$tpe"}, which is not
14411441
|declared to take any.
14421442
|"""
14431443
}

0 commit comments

Comments
 (0)