Skip to content

Commit 094d8c5

Browse files
remove var ContextBase.suppressNonSensicalErrors, and
decouple Diagnostic from ContextBase
1 parent a846ccf commit 094d8c5

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,6 @@ object Contexts {
504504

505505
protected[dotc] val indentTab = " "
506506

507-
/** Should warnings and errors containing non-sensical strings be suppressed? */
508-
private[dotc] var suppressNonSensicalErrors = true
509-
510507
def reset() = {
511508
for ((_, set) <- uniqueSets) set.clear()
512509
for (i <- 0 until classOfId.length) classOfId(i) = null

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import java.lang.System.currentTimeMillis
1313

1414
object Reporter {
1515

16-
class Diagnostic(msgFn: => String, val pos: SourcePosition, val severity: Severity, base: ContextBase) extends Exception {
16+
class Diagnostic(msgFn: => String, val pos: SourcePosition, val severity: Severity) extends Exception {
1717
private var myMsg: String = null
1818
private var myIsSuppressed: Boolean = false
1919
def msg: String = {
@@ -22,10 +22,7 @@ object Reporter {
2222
catch {
2323
case ex: SuppressedMessage =>
2424
myIsSuppressed = true
25-
val saved = base.suppressNonSensicalErrors
26-
base.suppressNonSensicalErrors = false
27-
try myMsg = msgFn
28-
finally base.suppressNonSensicalErrors = saved
25+
myMsg = "<suppressed message>"
2926
}
3027
myMsg
3128
}
@@ -38,8 +35,8 @@ object Reporter {
3835
else severity
3936
}
4037

41-
def Diagnostic(msgFn: => String, pos: SourcePosition, severity: Severity)(implicit ctx: Context) =
42-
new Diagnostic(msgFn, pos, severity, ctx.base)
38+
def Diagnostic(msgFn: => String, pos: SourcePosition, severity: Severity) =
39+
new Diagnostic(msgFn, pos, severity)
4340

4441
class Severity(val level: Int) extends AnyVal {
4542
override def toString = this match {

0 commit comments

Comments
 (0)