-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Partial events and constructors: IDE #77337
base: features/PartialEventsCtors
Are you sure you want to change the base?
Partial events and constructors: IDE #77337
Conversation
@cston @RikkiGibson FYI |
@dotnet/roslyn-ide for a review, thanks |
symbol = (symbol as IPropertySymbol)?.PartialImplementationPart ?? symbol; | ||
symbol = symbol switch | ||
{ | ||
IMethodSymbol method => method.PartialImplementationPart ?? method, |
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.
nit: it feels like the pattern itself could also just test that the PartialImplementationPart
is non-null, and the _ => symbol
case can be used instead of ?? method
, etc. in these arms.
return CreateResolution(result, $"({nameof(EventSymbolKey)} '{metadataName}' not found)", out failureReason); | ||
using var events = GetMembersOfNamedType<IEventSymbol>(containingTypeResolution, metadataName); | ||
|
||
if (events.Count == 1 && isPartialImplementationPart) |
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.
It looks like this is making use of an assumption that events are not overloaded. Is this really what we want to do when, say, erroneous duplicated partial events are present in source?
@@ -238,6 +238,12 @@ private static bool IsPartialMethodDefinitionPart(IPropertySymbol symbol) | |||
private static bool IsPartialMethodImplementationPart(IPropertySymbol symbol) | |||
=> symbol.PartialDefinitionPart != null; | |||
|
|||
private static bool IsPartialMethodDefinitionPart(IEventSymbol symbol) |
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.
It might be good to name these according to the symbol kinds they actually deal with, i.e. IsPartialEventDefinitionPart
. Not critical, though.
Assert.NotSame(implementation, definition); | ||
|
||
// Assert that both the definition and implementation resolve back to themselves | ||
Assert.Equal(definition, ResolveSymbol(definition, comp, SymbolKeyComparison.None)); |
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.
nit: Assert.Same
?
i can look at these tomorrow. |
Test plan: #76859