Skip to content

Commit 049eafe

Browse files
committed
Fix rebase breakages
1 parent f95dfb7 commit 049eafe

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,12 @@ object SyntaxHighlighting {
2929
val TypeColor = Console.MAGENTA
3030
val AnnotationColor = Console.MAGENTA
3131

32-
private class NoReporter extends Reporter {
33-
override def doReport(m: MessageContainer)(implicit ctx: Context): Unit = ()
34-
}
35-
3632
def highlight(in: String)(implicit ctx: Context): String = {
37-
def freshCtx = ctx.fresh.setReporter(new NoReporter)
33+
def freshCtx = ctx.fresh.setReporter(Reporter.NoReporter)
3834
if (in.isEmpty || ctx.settings.color.value == "never") in
3935
else {
4036
implicit val ctx = freshCtx
41-
val source = new SourceFile("<highlighting>", in.toCharArray)
37+
val source = new SourceFile("<highlighting>", in)
4238
val colorAt = Array.fill(in.length)(NoColor)
4339

4440
def highlightRange(from: Int, to: Int, color: String) =

compiler/src/dotty/tools/dotc/reporting/MessageRendering.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ trait MessageRendering {
6262

6363
val syntax =
6464
if (ctx.settings.color.value != "never")
65-
SyntaxHighlighting.highlight(new String(pos.linesSlice)).toArray
65+
SyntaxHighlighting.highlight(new String(pos.linesSlice)).toCharArray
6666
else pos.linesSlice
6767
val lines = linesFrom(syntax)
6868
val (before, after) = pos.beforeAndAfterPoint

compiler/src/dotty/tools/repl/JLineTerminal.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ final class JLineTerminal extends java.io.Closeable {
6868
/** Provide syntax highlighting */
6969
private class Highlighter(implicit ctx: Context) extends reader.Highlighter {
7070
def highlight(reader: LineReader, buffer: String): AttributedString = {
71-
val highlighted = SyntaxHighlighting(buffer).mkString
71+
val highlighted = SyntaxHighlighting.highlight(buffer)
7272
AttributedString.fromAnsi(highlighted)
7373
}
7474
}

compiler/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,14 @@ class ReplDriver(settings: Array[String],
341341
case TypeOf(expr) =>
342342
compiler.typeOf(expr)(newRun(state)).fold(
343343
displayErrors,
344-
res => out.println(SyntaxHighlighting(res)(state.context))
344+
res => out.println(SyntaxHighlighting.highlight(res)(state.context))
345345
)
346346
state
347347

348348
case DocOf(expr) =>
349349
compiler.docOf(expr)(newRun(state)).fold(
350350
displayErrors,
351-
res => out.println(SyntaxHighlighting(res)(state.context))
351+
res => out.println(SyntaxHighlighting.highlight(res)(state.context))
352352
)
353353
state
354354

0 commit comments

Comments
 (0)