-
Notifications
You must be signed in to change notification settings - Fork 441
Add to match this opening <thing>
notes to the diagnostics
#862
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
703bc67
to
753ceca
Compare
@swift-ci Please test |
753ceca
to
9b54586
Compare
@swift-ci Please test |
if let notes = spec.notes { | ||
if diag.notes.count != notes.count { | ||
XCTFail(""" | ||
Expected \(notes.count) notes but received \(diag.notes.count): |
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.
Could print the expected notes as well?
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 explicitly didn’t print the expected notes because the test failure will point to where the DiagnosticSpec
is declared and the expected notes will be shown there anyway. So I think there is very little value in printing the expected notes. This matches what we are doing for diagnostics as well.
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 had a comment there too :P. I generally like having everything in the error, makes it easier to attach them to issues and figure out the problem at a glance (rather than going to the test, comparing the output to what's in the test, etc). I don't feel particularly strongly about this though.
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 disagree but fair enough. If you want to add it, I won’t oppose you. 😜
@@ -246,9 +328,10 @@ func AssertParse<Node: RawSyntaxNodeProtocol>( | |||
Expected \(expectedDiagnostics.count) diagnostics but received \(diags.count): |
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.
Same comment as for notes, would be nice to print all expected as well.
public let position: AbsolutePosition | ||
|
||
/// A description of what this note is pointing at. | ||
public let noteMessage: NoteMessage |
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'm still not sure having an ID for note/diagnostic is really worth it. But we can keep it for now 🤷
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 still think it’s very little overhead at this point and once a use case comes up we will be glad that we have so we don’t need to do string matching for the error message.
For diagnostics like
expected '}' to end actor
issue a correspondingto match this opening '{'
This resolves 38 TODOs, down to 1025.