Skip to content

Commit 4b08b9c

Browse files
committed
Fix rebase breakages
1 parent 1380ad5 commit 4b08b9c

File tree

3 files changed

+6
-10
lines changed

3 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
@@ -27,16 +27,12 @@ object SyntaxHighlighting {
2727
val TypeColor = Console.MAGENTA
2828
val AnnotationColor = Console.MAGENTA
2929

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

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ final class JLineTerminal extends java.io.Closeable {
6363
def close() = terminal.close()
6464

6565
/** Provide syntax highlighting */
66-
private class Highlighter extends reader.Highlighter {
66+
private class Highlighter(implicit ctx: Context) extends reader.Highlighter {
6767
def highlight(reader: LineReader, buffer: String): AttributedString = {
68-
val highlighted = SyntaxHighlighting(buffer).mkString
68+
val highlighted = SyntaxHighlighting.highlight(buffer)
6969
AttributedString.fromAnsi(highlighted)
7070
}
7171
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class ReplDriver(settings: Array[String],
320320

321321
case Imports =>
322322
implicit val ctx = state.context
323-
state.imports.foreach(i => out.println(SyntaxHighlighting.highlight(i.show))
323+
state.imports.foreach(i => out.println(SyntaxHighlighting.highlight(i.show)))
324324
state
325325

326326
case Load(path) =>
@@ -337,7 +337,7 @@ class ReplDriver(settings: Array[String],
337337
case TypeOf(expr) =>
338338
compiler.typeOf(expr)(newRun(state)).fold(
339339
displayErrors,
340-
res => out.println(SyntaxHighlighting.highlight(res)(state.run.runContext))
340+
res => out.println(SyntaxHighlighting.highlight(res)(state.context))
341341
)
342342
state
343343

0 commit comments

Comments
 (0)