@@ -16,23 +16,23 @@ import dotty.tools.dotc.core.Symbols.Symbol
16
16
import ErrorMessages ._
17
17
18
18
object Reporter {
19
- class Error (msgFn : => String , pos : SourcePosition ) extends Diagnostic (msgFn, pos, ERROR )
20
- class Warning (msgFn : => String , pos : SourcePosition ) extends Diagnostic (msgFn, pos, WARNING )
21
- class Info (msgFn : => String , pos : SourcePosition ) extends Diagnostic (msgFn, pos, INFO )
19
+ class Error (msgFn : => String , pos : SourcePosition , kind : String = " Error " ) extends Diagnostic (msgFn, pos, ERROR , kind )
20
+ class Warning (msgFn : => String , pos : SourcePosition , kind : String = " Warning " ) extends Diagnostic (msgFn, pos, WARNING , kind )
21
+ class Info (msgFn : => String , pos : SourcePosition , kind : String = " Info " ) extends Diagnostic (msgFn, pos, INFO , kind )
22
22
23
- abstract class ConditionalWarning (msgFn : => String , pos : SourcePosition ) extends Warning (msgFn, pos) {
23
+ abstract class ConditionalWarning (msgFn : => String , pos : SourcePosition , kind : String ) extends Warning (msgFn, pos, kind ) {
24
24
def enablingOption (implicit ctx : Context ): Setting [Boolean ]
25
25
}
26
- class FeatureWarning (msgFn : => String , pos : SourcePosition ) extends ConditionalWarning (msgFn, pos) {
26
+ class FeatureWarning (msgFn : => String , pos : SourcePosition , kind : String = " Feature Warning " ) extends ConditionalWarning (msgFn, pos, kind ) {
27
27
def enablingOption (implicit ctx : Context ) = ctx.settings.feature
28
28
}
29
- class UncheckedWarning (msgFn : => String , pos : SourcePosition ) extends ConditionalWarning (msgFn, pos) {
29
+ class UncheckedWarning (msgFn : => String , pos : SourcePosition , kind : String = " Unchecked Warning " ) extends ConditionalWarning (msgFn, pos, kind ) {
30
30
def enablingOption (implicit ctx : Context ) = ctx.settings.unchecked
31
31
}
32
- class DeprecationWarning (msgFn : => String , pos : SourcePosition ) extends ConditionalWarning (msgFn, pos) {
32
+ class DeprecationWarning (msgFn : => String , pos : SourcePosition , kind : String = " Deprecation Warning " ) extends ConditionalWarning (msgFn, pos, kind ) {
33
33
def enablingOption (implicit ctx : Context ) = ctx.settings.deprecation
34
34
}
35
- class MigrationWarning (msgFn : => String , pos : SourcePosition ) extends ConditionalWarning (msgFn, pos) {
35
+ class MigrationWarning (msgFn : => String , pos : SourcePosition , kind : String = " Migration Warning " ) extends ConditionalWarning (msgFn, pos, kind ) {
36
36
def enablingOption (implicit ctx : Context ) = ctx.settings.migration
37
37
}
38
38
@@ -56,19 +56,19 @@ trait Reporting { this: Context =>
56
56
if (this .settings.verbose.value) this .echo(msg, pos)
57
57
58
58
def echo (msg : => String , pos : SourcePosition = NoSourcePosition ): Unit =
59
- reporter.report(new Info (msg, pos))
59
+ reporter.report(new Info (msg, pos, " Info " ))
60
60
61
61
def deprecationWarning (msg : => String , pos : SourcePosition = NoSourcePosition ): Unit =
62
- reporter.report(new DeprecationWarning (msg, pos))
62
+ reporter.report(new DeprecationWarning (msg, pos, " Deprecation Warning " ))
63
63
64
64
def migrationWarning (msg : => String , pos : SourcePosition = NoSourcePosition ): Unit =
65
- reporter.report(new MigrationWarning (msg, pos))
65
+ reporter.report(new MigrationWarning (msg, pos, " Migration Warning " ))
66
66
67
67
def uncheckedWarning (msg : => String , pos : SourcePosition = NoSourcePosition ): Unit =
68
- reporter.report(new UncheckedWarning (msg, pos))
68
+ reporter.report(new UncheckedWarning (msg, pos, " Unchecked Warning " ))
69
69
70
70
def featureWarning (msg : => String , pos : SourcePosition = NoSourcePosition ): Unit =
71
- reporter.report(new FeatureWarning (msg, pos))
71
+ reporter.report(new FeatureWarning (msg, pos, " Feature Warning " ))
72
72
73
73
def featureWarning (feature : String , featureDescription : String , isScala2Feature : Boolean ,
74
74
featureUseSite : Symbol , required : Boolean , pos : SourcePosition ): Unit = {
@@ -97,7 +97,7 @@ trait Reporting { this: Context =>
97
97
reporter.report(new Warning (msg, pos))
98
98
99
99
def explainWarning (err : => ErrorMessage , pos : SourcePosition = NoSourcePosition ): Unit = {
100
- warning( err.msg, pos)
100
+ reporter.report( new Warning ( err.msg, pos, s " ${err.kind} warning " ) )
101
101
if (this .shouldExplain(err))
102
102
reporter.report(new Info (err.explanation, NoSourcePosition ))
103
103
}
@@ -112,7 +112,7 @@ trait Reporting { this: Context =>
112
112
}
113
113
114
114
def explainError (err : => ErrorMessage , pos : SourcePosition = NoSourcePosition ): Unit = {
115
- error( err.msg, pos)
115
+ reporter.report( new Error ( err.msg, pos, s " ${err.kind} error " ) )
116
116
if (this .shouldExplain(err))
117
117
reporter.report(new Info (err.explanation, NoSourcePosition ))
118
118
}
0 commit comments