-
Notifications
You must be signed in to change notification settings - Fork 949
feat: update Problem to account for related information and code #6871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
internal/util-interface/src/main/java/xsbti/DiagnosticRelatedInformation.java
Outdated
Show resolved
Hide resolved
internal/util-interface/src/main/java/xsbti/DiagnosticRelatedInformation.java
Outdated
Show resolved
Hide resolved
* <p>NOTE: To avoid breaking compatibility we provide a default to account for older Scala | ||
* version that do not have codes. | ||
*/ | ||
default Optional<DiagnosticCode> diagnosticCode() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this enough information to get sbt to produce errors that look like what dotty natively produce without us having to pass in a rendered
string? That would help solve scala/scala3#14691
@ckipp01 Thanks for the contribution. Could you target 1.7.x branch instead which runs mima, plz? |
This PR makes changes to the existing `xsbti.Problem` to account for an optional diagnostic code that the compiler can return for a given diagnostic and also related information. Given a piece of code like: ```scala try {} ``` You'll receive the following: ``` -- [E002] Syntax Warning: /Users/ckipp/Documents/scala-workspace/dotty-error-index/examples/002_EmptyCatchAndFinallyBlockID.scala:3:2 3 | try {} | ^^^^^^ | A try without catch or finally is equivalent to putting | its body in a block; no exceptions are handled. ``` The `E002` here is the actual code. Right now there would be no description. Some diagnostics have multiple positions that they need to represent. You can see an example of this [here](scala/scala3#14002) in Dotty with the use of inlining. Instead of needing to rely on including all of that information in the diagnostic message it can now be extracted out into a `DiagnosticRelatedInformation`. These changes reference the conversation in sbt#6868
Sure, the rebase isn't clean, so it's just easier for me to close and open another. I'll go ahead and do that. |
This PR makes changes to the existing
xsbti.Problem
to account for anoptional diagnostic code that the compiler can return for a given
diagnostic and also related information.
Example of
DiagnosticCode
Given a piece of code like:
try {}
You'll receive the following:
The
E002
here is the actual code. Right now there would be nodescription.
Example of
DiagnosticRelatedInformation
Some diagnostics have multiple positions that they need to represent.
You can see an example of this
here in Dotty with the
use of inlining. Instead of needing to rely on including all of that
information in the diagnostic message it can now be extracted out into
a
DiagnosticRelatedInformation
.These changes reference the conversation in #6868