Skip to content
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

Consistently return the same value from MethodSymbol.IteratorElementTypeWithAnnotations API #65291

Merged
merged 2 commits into from
Nov 9, 2022

Conversation

AlekseyTs
Copy link
Contributor

Fixes #40014.

@AlekseyTs AlekseyTs marked this pull request as ready for review November 9, 2022 14:56
@AlekseyTs AlekseyTs requested a review from a team as a code owner November 9, 2022 14:56
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review

var local = model.GetDeclaredSymbol(declaration).GetSymbol<MethodSymbol>();

Assert.True(local.IsIterator);
Assert.Equal("System.Int32", local.IteratorElementTypeWithAnnotations.ToTestDisplayString());
Copy link
Member

@jcouv jcouv Nov 9, 2022

Choose a reason for hiding this comment

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

nit: do we have a test for calling IteratorElementTypeWithAnnotations on a non-iterator method (the null case)? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we have a test for calling IteratorElementTypeWithAnnotations on a non-iterator method (the null case)?

I do not know. Is there a specific concern?

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, I thought it was a public API.

@@ -2366,8 +2366,22 @@ public unsafe IEnumerable<int> M4(int* a)
})();
}
}";
CreateCompilation(src, options: TestOptions.UnsafeDebugDll)
.VerifyDiagnostics(
var comp = CreateCompilation(src, options: TestOptions.UnsafeDebugDll, parseOptions: TestOptions.RegularNext.WithFeature("run-nullable-analysis", "never"));
Copy link
Member

@jcouv jcouv Nov 9, 2022

Choose a reason for hiding this comment

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

Why skip nullable analysis? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why skip nullable analysis?

Because it binds the body before we can get the symbol, which defeats the purpose of the test.

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 2)

@jcouv jcouv self-assigned this Nov 9, 2022
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

LGTM (commit 2)

@AlekseyTs AlekseyTs merged commit 072e9b4 into dotnet:main Nov 9, 2022
@ghost ghost added this to the Next milestone Nov 9, 2022
@allisonchou allisonchou modified the milestones: Next, 17.5 P2 Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants