Skip to content

Conversation

@sharwell
Copy link
Contributor

No description provided.

@sharwell sharwell requested a review from a team as a code owner February 18, 2020 19:52
char M(out int i, out string s)
{
[|return 'a';|]
{|CS0177:{|CS0177:return 'a';|}|}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, duplicate diagnostics need nested annotation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interested in hearing what this is about as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All diagnostics must be declared. There is no such thing as a "nested" annotation; this is just a visual artifact caused by one diagnostic's span being a superset of another.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one diagnostic's span being a superset of another.

but in this case, the spans are identical.

  1. does this indicate an issue with the analyzer (producing duplicate diagnostics)
  2. if they're identical, does the test need to declare both?

Copy link
Contributor Author

@sharwell sharwell Feb 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no analyzer here. The compiler reported both diagnostics.

All diagnostics must be declared. It is common for distinct diagnostics to appear in the same location, e.g. when the message differs.

{
var generator = editor.Generator;

if (exprOrStatement is LocalFunctionStatementSyntax { ExpressionBody: { } localFunctionExpressionBody })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tagging @CyrusNajmabadi for the product change, as I believe he added these code fixes.

Copy link
Contributor Author

@sharwell sharwell Feb 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The results here were totally wrong. The code fix made a change in an unrelated method, with two impacts:

  1. The original diagnostic was still reported in the same place, with a code fix offered
  2. The iterative application of code fixes was an infinite loop, adding more incorrect code with each iteration

There was no way to port the test of local functions without this change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yikes!

Copy link
Contributor

@mavasani mavasani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test changes LGTM

@CyrusNajmabadi
Copy link
Member

@sharwell because of the largely mechanical nature of the test changes, it's somewhat tedious to review. If possible, would you be willing to go through and call out anything of particular interest (in the test changes) to make the review more expedient? That way we can focus on the important bits, skim the rest, and get through a lot faster.

Thanks!

Comment on lines 354 to +358
void X()
{
char D(out int i) => [|'a';|]
char {|CS0177:D|}(out int i) => 'a';
D(out _);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Prior to my change, the code fix for this produced this method:

void X()
{
    i = 0;
    char D(out int i) => 'a';
    D(out _);
}

@sharwell
Copy link
Contributor Author

@sharwell because of the largely mechanical nature of the test changes, it's somewhat tedious to review. If possible, would you be willing to go through and call out anything of particular interest (in the test changes) to make the review more expedient? That way we can focus on the important bits, skim the rest, and get through a lot faster.

@CyrusNajmabadi I've now commented on the PRs sent to date. For future changes, I'll submit the PR as a draft, and include the annotations before marking it ready for review.

@sharwell sharwell merged commit 1d587b2 into dotnet:master Feb 19, 2020
@sharwell sharwell deleted the assign-out branch February 19, 2020 17:15
@sharwell sharwell added this to the 16.6.P1 milestone Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants