Skip to content

Commit 0ded263

Browse files
committed
Rename Reporter#echo -> println
More refular that way. Also, change some raw printlns in low-level code to reporter.printlns in order to harden them against prints over prints.
1 parent d15c6ba commit 0ded263

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/dotty/tools/dotc/config/CompilerCommand.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,19 @@ object CompilerCommand extends DotClass {
110110

111111
if (summary.errors.nonEmpty) {
112112
summary.errors foreach (ctx.error(_))
113-
ctx.echo(" dotc -help gives more information")
113+
ctx.println(" dotc -help gives more information")
114114
Nil
115115
}
116116
else if (settings.version.value) {
117-
ctx.echo(versionMsg)
117+
ctx.println(versionMsg)
118118
Nil
119119
}
120120
else if (shouldStopWithInfo) {
121-
ctx.echo(infoMessage)
121+
ctx.println(infoMessage)
122122
Nil
123123
} else {
124124
if (summary.arguments.isEmpty && !settings.resident.value)
125-
ctx.echo(usageMessage)
125+
ctx.println(usageMessage)
126126
summary.arguments
127127
}
128128
}

src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,13 +1148,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi
11481148
}
11491149

11501150
/** Show subtype goal that led to an assertion failure */
1151-
def showGoal(tp1: Type, tp2: Type) = {
1152-
println(disambiguated(implicit ctx => s"assertion failure for ${tp1.show} <:< ${tp2.show}, frozen = $frozenConstraint"))
1151+
def showGoal(tp1: Type, tp2: Type)(implicit ctx: Context) = {
1152+
ctx.println(disambiguated(implicit ctx => s"assertion failure for ${tp1.show} <:< ${tp2.show}, frozen = $frozenConstraint"))
11531153
def explainPoly(tp: Type) = tp match {
1154-
case tp: PolyParam => println(s"polyparam ${tp.show} found in ${tp.binder.show}")
1155-
case tp: TypeRef if tp.symbol.exists => println(s"typeref ${tp.show} found in ${tp.symbol.owner.show}")
1156-
case tp: TypeVar => println(s"typevar ${tp.show}, origin = ${tp.origin}")
1157-
case _ => println(s"${tp.show} is a ${tp.getClass}")
1154+
case tp: PolyParam => ctx.println(s"polyparam ${tp.show} found in ${tp.binder.show}")
1155+
case tp: TypeRef if tp.symbol.exists => ctx.println(s"typeref ${tp.show} found in ${tp.symbol.owner.show}")
1156+
case tp: TypeVar => ctx.println(s"typevar ${tp.show}, origin = ${tp.origin}")
1157+
case _ => ctx.println(s"${tp.show} is a ${tp.getClass}")
11581158
}
11591159
explainPoly(tp1)
11601160
explainPoly(tp2)

src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ object Types {
504504
case ex: MergeError =>
505505
throw new MergeError(s"${ex.getMessage} as members of type ${pre.show}")
506506
case ex: Throwable =>
507-
println(i"findMember exception for $this member $name")
507+
ctx.println(i"findMember exception for $this member $name")
508508
throw ex // DEBUG
509509
}
510510
finally {

src/dotty/tools/dotc/reporting/Reporter.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ trait Reporting { this: Context =>
7474

7575
/** For sending messages that are printed only if -verbose is set */
7676
def inform(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
77-
if (this.settings.verbose.value) echo(msg, pos)
77+
if (this.settings.verbose.value) this.println(msg, pos)
7878

79-
def echo(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
79+
def println(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
8080
reporter.report(new Info(msg, pos))
8181

8282
def deprecationWarning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
@@ -112,7 +112,7 @@ trait Reporting { this: Context =>
112112
*/
113113
def log(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
114114
if (this.settings.log.value.containsPhase(phase))
115-
echo(s"[log ${ctx.phasesStack.reverse.mkString(" -> ")}] $msg", pos)
115+
this.println(s"[log ${ctx.phasesStack.reverse.mkString(" -> ")}] $msg", pos)
116116

117117
def debuglog(msg: => String): Unit =
118118
if (ctx.debug) log(msg)
@@ -232,10 +232,10 @@ abstract class Reporter {
232232

233233
/** Print a summary */
234234
def printSummary(implicit ctx: Context): Unit = {
235-
if (warningCount > 0) ctx.echo(countString(warningCount, "warning") + " found")
236-
if (errorCount > 0) ctx.echo(countString(errorCount, "error") + " found")
235+
if (warningCount > 0) ctx.println(countString(warningCount, "warning") + " found")
236+
if (errorCount > 0) ctx.println(countString(errorCount, "error") + " found")
237237
for ((settingName, count) <- unreportedWarnings)
238-
ctx.echo(s"there were $count ${settingName.tail} warning(s); re-run with $settingName for details")
238+
ctx.println(s"there were $count ${settingName.tail} warning(s); re-run with $settingName for details")
239239
}
240240

241241
/** Returns a string meaning "n elements". */

0 commit comments

Comments
 (0)