@@ -38,16 +38,16 @@ trait Reporting { this: Context =>
3838 reporter.report(new Info (msg, pos))
3939
4040 def deprecationWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
41- reporter.report(msg.deprecationWarning( pos))
41+ reporter.report(new DeprecationWarning (msg, pos))
4242
4343 def migrationWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
44- reporter.report(msg.migrationWarning( pos))
44+ reporter.report(new MigrationWarning (msg, pos))
4545
4646 def uncheckedWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
47- reporter.report(msg.uncheckedWarning( pos))
47+ reporter.report(new UncheckedWarning (msg, pos))
4848
4949 def featureWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
50- reporter.report(msg.featureWarning( pos))
50+ reporter.report(new FeatureWarning (msg, pos))
5151
5252 def featureWarning (feature : String , featureDescription : String , isScala2Feature : Boolean ,
5353 featureUseSite : Symbol , required : Boolean , pos : SourcePosition ): Unit = {
@@ -73,23 +73,27 @@ trait Reporting { this: Context =>
7373 }
7474
7575 def warning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
76- reporter.report(msg.warning( pos))
76+ reporter.report(new Warning (msg, pos))
7777
7878 def strictWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
7979 if (this .settings.strict.value) error(msg, pos)
80- else warning(msg.mapMsg(_ + " \n (This would be an error under strict mode)" ), pos)
80+ else reporter.report {
81+ new ExtendMessage (() => msg)(_ + " \n (This would be an error under strict mode)" ).warning(pos)
82+ }
8183
8284 def error (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
83- reporter.report(msg.error( pos))
85+ reporter.report(new Error (msg, pos))
8486
8587 def errorOrMigrationWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
8688 if (ctx.scala2Mode) migrationWarning(msg, pos) else error(msg, pos)
8789
8890 def restrictionError (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
89- error(msg.mapMsg(m => s " Implementation restriction: $m" ), pos)
91+ reporter.report {
92+ new ExtendMessage (() => msg)(m => s " Implementation restriction: $m" ).error(pos)
93+ }
9094
91- def incompleteInputError (msg : Message , pos : SourcePosition = NoSourcePosition )(implicit ctx : Context ): Unit =
92- reporter.incomplete(msg.error( pos))(ctx)
95+ def incompleteInputError (msg : => Message , pos : SourcePosition = NoSourcePosition )(implicit ctx : Context ): Unit =
96+ reporter.incomplete(new Error (msg, pos))(ctx)
9397
9498 /** Log msg if settings.log contains the current phase.
9599 * See [[config.CompilerCommand#explainAdvanced ]] for the exact meaning of
@@ -192,7 +196,7 @@ trait Reporting { this: Context =>
192196abstract class Reporter extends interfaces.ReporterResult {
193197
194198 /** Report a diagnostic */
195- def doReport (d : MessageContainer )(implicit ctx : Context ): Unit
199+ def doReport (m : MessageContainer )(implicit ctx : Context ): Unit
196200
197201 /** Whether very long lines can be truncated. This exists so important
198202 * debugging information (like printing the classpath) is not rendered
@@ -236,22 +240,22 @@ abstract class Reporter extends interfaces.ReporterResult {
236240 override def default (key : String ) = 0
237241 }
238242
239- def report (d : MessageContainer )(implicit ctx : Context ): Unit =
240- if (! isHidden(d )) {
241- doReport(d )(ctx.addMode(Mode .Printing ))
242- d match {
243- case d : ConditionalWarning if ! d .enablingOption.value => unreportedWarnings(d .enablingOption.name) += 1
244- case d : Warning => warningCount += 1
245- case d : Error =>
246- errors = d :: errors
243+ def report (m : MessageContainer )(implicit ctx : Context ): Unit =
244+ if (! isHidden(m )) {
245+ doReport(m )(ctx.addMode(Mode .Printing ))
246+ m match {
247+ case m : ConditionalWarning if ! m .enablingOption.value => unreportedWarnings(m .enablingOption.name) += 1
248+ case m : Warning => warningCount += 1
249+ case m : Error =>
250+ errors = m :: errors
247251 errorCount += 1
248- case d : Info => // nothing to do here
252+ case m : Info => // nothing to do here
249253 // match error if d is something else
250254 }
251255 }
252256
253- def incomplete (d : MessageContainer )(implicit ctx : Context ): Unit =
254- incompleteHandler(d )(ctx)
257+ def incomplete (m : MessageContainer )(implicit ctx : Context ): Unit =
258+ incompleteHandler(m )(ctx)
255259
256260 /** Summary of warnings and errors */
257261 def summary : String = {
0 commit comments