Skip to content

Annotate remaining symbol interfaces#39184

Merged
sharwell merged 2 commits intodotnet:masterfrom
sharwell:symbol-annotations-2
Oct 15, 2019
Merged

Annotate remaining symbol interfaces#39184
sharwell merged 2 commits intodotnet:masterfrom
sharwell:symbol-annotations-2

Conversation

@sharwell
Copy link
Contributor

This pull request includes interfaces except for ISymbol itself.

@sharwell sharwell requested review from a team as code owners October 10, 2019 00:17
@sharwell sharwell force-pushed the symbol-annotations-2 branch from 2bfca77 to 5b81932 Compare October 10, 2019 00:28
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 1)

@jcouv
Copy link
Member

jcouv commented Oct 14, 2019

    ImmutableArray<ISymbol> GetMembers(string name);

nit: I think this API technically allows a null input (couldn't find an implementation that didn't). On the other hand, it is not particularly useful, so okay to leave as-is.
Same for GetTypeMembers below


Refers to: src/Compilers/Core/Portable/Symbols/INamespaceOrTypeSymbol.cs:32 in 295cc81. [](commit_id = 295cc81, deletion_comment = False)

@jcouv jcouv self-assigned this Oct 14, 2019
@jcouv jcouv added this to the 16.4.P3 milestone Oct 14, 2019
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 1) with some nits to consider

@sharwell
Copy link
Contributor Author

sharwell commented Oct 14, 2019

On the other hand, it is not particularly useful, so okay to leave as-is.

I'm leaving GetMembers and GetTypeMembers as-is for now. The inputs can be widened in the future if desired without any negative impact to consumers. It will be easier to make such a change after the implementations are NRT-enabled.

private static bool HasBackingField(IEventSymbol @event)
{
#nullable disable // https://github.com/dotnet/roslyn/issues/39288
return @event.AddMethod.IsImplicitlyDeclared
Copy link
Member

@tmat tmat Oct 15, 2019

Choose a reason for hiding this comment

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

The doc on AddMethod says "Null only in error scenarios.". The EnC analyzer does not perform semantic analysis in documents that have syntax errors. It would be useful to clarify what "error scenarios" means - is it syntax errors in the event declaration or could it also be a semantic error? I'd think that the symbol will be non-null in presence of semantic errors (error symbols might be present in the method symbol signature, but it won't be null).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to leave this for a follow-up change per #39288

Copy link
Member

Choose a reason for hiding this comment

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

@gafter @333fred @agocke Could you please clarify what are the "error scenarios" mentioned in doc comments of IEventSymbol.AddMethod? Are these syntactic or semantic errors?

Copy link
Member

@RikkiGibson RikkiGibson Oct 15, 2019

Choose a reason for hiding this comment

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

The only time I'm aware of it happening is when the event has an accessor list that is missing an accessor. I think it's not a syntax error because it's not contained in SyntaxTree.GetDiagnostics() for the tree containing the bad declaration. It is reported when we are creating the source event symbol.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Seems like we may have a bug here.

@sharwell sharwell merged commit 1fb048f into dotnet:master Oct 15, 2019
@sharwell sharwell deleted the symbol-annotations-2 branch October 15, 2019 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants