File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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._
99import dotty .tools .dotc .interfaces .Diagnostic .{ERROR , INFO , WARNING }
1010import dotty .tools .dotc .util .SourcePosition
1111
12- import java .util .Optional
12+ import java .util .{ Collections , Optional , List => JList }
1313import scala .util .chaining ._
1414import core .Decorators .toMessage
1515
@@ -100,6 +100,8 @@ class Diagnostic(
100100 if (pos.exists && pos.source.exists) Optional .of(pos) else Optional .empty()
101101 override def message : String =
102102 msg.message.replaceAll(" \u001B\\ [[;\\ d]*m" , " " )
103+ override def diagnosticRelatedInformation : JList [interfaces.DiagnosticRelatedInformation ] =
104+ Collections .emptyList()
103105
104106 override def toString : String = s " $getClass at $pos: $message"
105107 override def getMessage (): String = message
Original file line number Diff line number Diff line change 11package dotty .tools .dotc .interfaces ;
22
33import java .util .Optional ;
4+ import java .util .List ;
45
56/** A diagnostic is a message emitted during the compilation process.
67 *
@@ -23,4 +24,7 @@ public interface Diagnostic {
2324 /** @return The position in a source file of the code that caused this diagnostic
2425 * to be emitted. */
2526 Optional <SourcePosition > position ();
27+
28+ /** @return A list of additional messages together with their code positions */
29+ List <DiagnosticRelatedInformation > diagnosticRelatedInformation ();
2630}
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 {
489489 settings(commonJavaSettings).
490490 settings(commonMiMaSettings).
491491 settings(
492- versionScheme := Some (" semver-spec" )
492+ versionScheme := Some (" semver-spec" ),
493+ mimaBinaryIssueFilters ++= MiMaFilters .Interfaces
493494 )
494495
495496 /** 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 {
77 ProblemFilters .exclude[DirectMissingMethodProblem ](" scala.caps.unsafeUnbox" ),
88 )
99 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+ )
1014}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import dotty.tools.dotc.core.Contexts._
99import dotty .tools .dotc .interfaces .Diagnostic .{ERROR , INFO , WARNING }
1010import dotty .tools .dotc .util .SourcePosition
1111
12- import java .util .Optional
12+ import java .util .{ Collections , Optional , List => JList }
1313import scala .util .chaining ._
1414import core .Decorators .toMessage
1515import language .experimental .pureFunctions
@@ -101,6 +101,8 @@ class Diagnostic(
101101 if (pos.exists && pos.source.exists) Optional .of(pos) else Optional .empty()
102102 override def message : String =
103103 msg.message.replaceAll(" \u001B\\ [[;\\ d]*m" , " " )
104+ override def diagnosticRelatedInformation : JList [interfaces.DiagnosticRelatedInformation ] =
105+ Collections .emptyList()
104106
105107 override def toString : String = s " $getClass at $pos: $message"
106108 override def getMessage (): String = message
You can’t perform that action at this time.
0 commit comments