Recognize union creation members defined in an interface acting as a union member provider#83048
Recognize union creation members defined in an interface acting as a union member provider#83048AlekseyTs wants to merge 2 commits intodotnet:features/Unionsfrom
Conversation
…union member provider
|
@jjonescz, @dotnet/roslyn-compiler For a second review |
| var definition = this.OriginalDefinition; | ||
| NamedTypeSymbol membersInterface = membersInterfaceForDefinition.AsMember(this); | ||
|
|
||
| foreach (var member in membersInterfaceForDefinition.GetMembers("Create")) |
There was a problem hiding this comment.
Should this be a constant in WellKnownMemberNames?
Good idea. I will add one in one of the next PRs
|
|
||
| if (type.DeclaredAccessibility != Accessibility.Public || | ||
| !type.IsInterface || | ||
| !this.OriginalDefinition.AllInterfacesNoUseSiteDiagnostics.Contains(type, Symbols.SymbolEqualityComparer.AllIgnoreOptions)) |
There was a problem hiding this comment.
Consider testing when the interface is defined in #nullable disabled region but implemented in #nullable enabled region (and/or vice versa) to verify the effect of the comparer. #Resolved
There was a problem hiding this comment.
While it would be good to have a test like that for completeness sake. I think that adding it has lowest priority, and I am comfortable not having a test like that. Especially that this comparer is used consistently throughout the feature code.
| ParameterCount: 1, | ||
| Parameters: [{ RefKind: RefKind.In or RefKind.None }] | ||
| } && | ||
| unionType.Equals(factory.ReturnType, TypeCompareKind.AllIgnoreOptions); |
There was a problem hiding this comment.
Do we have a test where the return type is an annotated nullable reference type? #Resolved
There was a problem hiding this comment.
ReturnType is a TypeSymbol, therefore, any top level nullability information is not present. Also, see response for a comment above.
Microsoft Reviewers: Open in CodeFlow