File tree 6 files changed +22
-3
lines changed
compiler/src/dotty/tools/dotc/reporting
interfaces/src/dotty/tools/dotc/interfaces
tests/pos-with-compiler-cc/dotc/reporting
6 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import dotty.tools.dotc.core.Contexts._
9
9
import dotty .tools .dotc .interfaces .Diagnostic .{ERROR , INFO , WARNING }
10
10
import dotty .tools .dotc .util .SourcePosition
11
11
12
- import java .util .Optional
12
+ import java .util .{ Collections , Optional , List => JList }
13
13
import scala .util .chaining ._
14
14
import core .Decorators .toMessage
15
15
@@ -100,6 +100,8 @@ class Diagnostic(
100
100
if (pos.exists && pos.source.exists) Optional .of(pos) else Optional .empty()
101
101
override def message : String =
102
102
msg.message.replaceAll(" \u001B\\ [[;\\ d]*m" , " " )
103
+ override def diagnosticRelatedInformation : JList [interfaces.DiagnosticRelatedInformation ] =
104
+ Collections .emptyList()
103
105
104
106
override def toString : String = s " $getClass at $pos: $message"
105
107
override def getMessage (): String = message
Original file line number Diff line number Diff line change 1
1
package dotty .tools .dotc .interfaces ;
2
2
3
3
import java .util .Optional ;
4
+ import java .util .List ;
4
5
5
6
/** A diagnostic is a message emitted during the compilation process.
6
7
*
@@ -23,4 +24,7 @@ public interface Diagnostic {
23
24
/** @return The position in a source file of the code that caused this diagnostic
24
25
* to be emitted. */
25
26
Optional <SourcePosition > position ();
27
+
28
+ /** @return A list of additional messages together with their code positions */
29
+ List <DiagnosticRelatedInformation > diagnosticRelatedInformation ();
26
30
}
Original file line number Diff line number Diff line change
1
+ package dotty .tools .dotc .interfaces ;
2
+
3
+ public interface DiagnosticRelatedInformation {
4
+ SourcePosition position ();
5
+ String message ();
6
+ }
Original file line number Diff line number Diff line change @@ -489,7 +489,8 @@ object Build {
489
489
settings(commonJavaSettings).
490
490
settings(commonMiMaSettings).
491
491
settings(
492
- versionScheme := Some (" semver-spec" )
492
+ versionScheme := Some (" semver-spec" ),
493
+ mimaBinaryIssueFilters ++= MiMaFilters .Interfaces
493
494
)
494
495
495
496
/** Find an artifact with the given `name` in `classpath` */
Original file line number Diff line number Diff line change @@ -7,4 +7,8 @@ object MiMaFilters {
7
7
ProblemFilters .exclude[DirectMissingMethodProblem ](" scala.caps.unsafeUnbox" ),
8
8
)
9
9
val TastyCore : Seq [ProblemFilter ] = Seq ()
10
+ val Interfaces : Seq [ProblemFilter ] = Seq (
11
+ ProblemFilters .exclude[MissingClassProblem ](" dotty.tools.dotc.interfaces.DiagnosticRelatedInformation" ),
12
+ ProblemFilters .exclude[ReversedMissingMethodProblem ](" dotty.tools.dotc.interfaces.Diagnostic.diagnosticRelatedInformation" )
13
+ )
10
14
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import dotty.tools.dotc.core.Contexts._
9
9
import dotty .tools .dotc .interfaces .Diagnostic .{ERROR , INFO , WARNING }
10
10
import dotty .tools .dotc .util .SourcePosition
11
11
12
- import java .util .Optional
12
+ import java .util .{ Collections , Optional , List => JList }
13
13
import scala .util .chaining ._
14
14
import core .Decorators .toMessage
15
15
import language .experimental .pureFunctions
@@ -101,6 +101,8 @@ class Diagnostic(
101
101
if (pos.exists && pos.source.exists) Optional .of(pos) else Optional .empty()
102
102
override def message : String =
103
103
msg.message.replaceAll(" \u001B\\ [[;\\ d]*m" , " " )
104
+ override def diagnosticRelatedInformation : JList [interfaces.DiagnosticRelatedInformation ] =
105
+ Collections .emptyList()
104
106
105
107
override def toString : String = s " $getClass at $pos: $message"
106
108
override def getMessage (): String = message
You can’t perform that action at this time.
0 commit comments