@@ -38,16 +38,16 @@ trait Reporting { this: Context =>
38
38
reporter.report(new Info (msg, pos))
39
39
40
40
def deprecationWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
41
- reporter.report(msg.deprecationWarning( pos))
41
+ reporter.report(new DeprecationWarning (msg, pos))
42
42
43
43
def migrationWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
44
- reporter.report(msg.migrationWarning( pos))
44
+ reporter.report(new MigrationWarning (msg, pos))
45
45
46
46
def uncheckedWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
47
- reporter.report(msg.uncheckedWarning( pos))
47
+ reporter.report(new UncheckedWarning (msg, pos))
48
48
49
49
def featureWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
50
- reporter.report(msg.featureWarning( pos))
50
+ reporter.report(new FeatureWarning (msg, pos))
51
51
52
52
def featureWarning (feature : String , featureDescription : String , isScala2Feature : Boolean ,
53
53
featureUseSite : Symbol , required : Boolean , pos : SourcePosition ): Unit = {
@@ -73,23 +73,27 @@ trait Reporting { this: Context =>
73
73
}
74
74
75
75
def warning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
76
- reporter.report(msg.warning( pos))
76
+ reporter.report(new Warning (msg, pos))
77
77
78
78
def strictWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
79
79
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
+ }
81
83
82
84
def error (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
83
- reporter.report(msg.error( pos))
85
+ reporter.report(new Error (msg, pos))
84
86
85
87
def errorOrMigrationWarning (msg : => Message , pos : SourcePosition = NoSourcePosition ): Unit =
86
88
if (ctx.scala2Mode) migrationWarning(msg, pos) else error(msg, pos)
87
89
88
90
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
+ }
90
94
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)
93
97
94
98
/** Log msg if settings.log contains the current phase.
95
99
* See [[config.CompilerCommand#explainAdvanced ]] for the exact meaning of
@@ -192,7 +196,7 @@ trait Reporting { this: Context =>
192
196
abstract class Reporter extends interfaces.ReporterResult {
193
197
194
198
/** Report a diagnostic */
195
- def doReport (d : MessageContainer )(implicit ctx : Context ): Unit
199
+ def doReport (m : MessageContainer )(implicit ctx : Context ): Unit
196
200
197
201
/** Whether very long lines can be truncated. This exists so important
198
202
* debugging information (like printing the classpath) is not rendered
@@ -236,22 +240,22 @@ abstract class Reporter extends interfaces.ReporterResult {
236
240
override def default (key : String ) = 0
237
241
}
238
242
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
247
251
errorCount += 1
248
- case d : Info => // nothing to do here
252
+ case m : Info => // nothing to do here
249
253
// match error if d is something else
250
254
}
251
255
}
252
256
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)
255
259
256
260
/** Summary of warnings and errors */
257
261
def summary : String = {
0 commit comments