-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Verifier: Support line numbers in fix-it verification #39572
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
cbdcc30
to
1030c71
Compare
@swift-ci please smoke test macOS |
1030c71
to
c4febeb
Compare
@swift-ci please smoke test macOS |
c4febeb
to
c0192a5
Compare
@swift-ci please smoke test macOS |
@rintaro Friendly ping |
ping |
I have completely dropped the ball on this one, sorry! I didn't know that I was a reviewer here but since I do now, I'll take a look ASAP. |
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.
Looks good to me! @rintaro Could you please take a look as well?
@rintaro ping |
Ooh, I'm so sorry it completely slipped my mind. I'll review it at the latest this weekend. 🙇 |
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.
The implementation looks pretty good.
I'm not a big fan of that this only accepts absolute line numbers while @
for expected-{error|warning|note}
only accepts offsets [+-]\d+
, but unfortunately -
is already used for the range separator, so I guess it can't be helped 😢
ExpectedFixIt FixIt; | ||
FixIt.StartLoc = OpenLoc; | ||
FixIt.EndLoc = CloseLoc; | ||
if (StartColStr.getAsInteger(10, FixIt.StartCol)) { | ||
if (FirstColonLoc != StringRef::npos) { |
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.
(Not in this PR)
I feel like not specifying the line should be considered implicitly specifying the same line. Like:
if (FirstColonLoc != StringRef::npos) {
...
} else {
// Implicitly on the same line as the diagnostics.
FixIt.Range.StartLine = Expected.LineNo;
}
...
if (SecondColonLoc != StringRef::npos) {
...
} else {
// Implicitly the same as the start line.
FixIt.Range.EndLine = FixIt.Range.StartLine;
}
assert(/*verify all values are not 'NoValue' */)
As a bonus, this simplifies the check logic, right?
I'm not sure how many failures that will cause in the current test suite, and also not sure how much checking lines for all fix-its will affect the performance. Do you think it's worth to try, or perhaps did you already try it?
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.
I feel like not specifying the line should be considered implicitly specifying the same line
I felt the same, and I also had concerns on the impact on performance, but I haven't tried. I definitely believe that diagnostics would greatly benefit from full-range fix-it verification, more so over time.
@swift-ci Please smoke test |
…:handleDiagnostic
c0192a5
to
4ebd9c0
Compare
@swift-ci Please smoke test |
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.
LGTM!
This will come in handy for fix-its that target a different line or span multiple lines. In particular, this applies to upcoming diagnostics described in SE-0309.