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

Allow enum preselection in Enum.HasFlag #43521

Conversation

jasonmalinowski
Copy link
Member

This enables preselection of the enum type if you're calling Enum.HasFlag:

image

@dpoeschl Any idea where the completion-level tests are of this? It seems Completion just defers to the type inferrer for what to preselect but I wasn't where we do testing for this.

It turns out the VB TypeInferrer tests never actually asserted the
resulting type is the type that we expected.
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner April 20, 2020 21:25
@genlu
Copy link
Member

genlu commented Apr 20, 2020

Any idea where the completion-level tests are of this? It seems Completion just defers to the type inferrer for what to preselect but I wasn't where we do testing for this.

http://sourceroslyn.io/#Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProviderTests.cs

@jasonmalinowski jasonmalinowski changed the title Allow enum preselection in Enum.HasFlags Allow enum preselection in Enum.HasFlag Apr 20, 2020
@jasonmalinowski jasonmalinowski force-pushed the allow-enum-preselection-in-hasflags branch from fe601e3 to a2c2116 Compare April 20, 2020 22:16
This allows enum completion to correctly offer the enum options
immediately which is likely what the user is trying to do.
@jasonmalinowski jasonmalinowski force-pushed the allow-enum-preselection-in-hasflags branch from a2c2116 to f54cd3a Compare April 20, 2020 22:40
@jasonmalinowski jasonmalinowski self-assigned this Apr 20, 2020
@jasonmalinowski jasonmalinowski requested a review from genlu April 20, 2020 22:56
@@ -117,6 +117,12 @@ protected static IEnumerable<TypeInferenceInfo> GetCollectionElementType(INamedT

return SpecializedCollections.EmptyEnumerable<TypeInferenceInfo>();
}

protected static bool IsEnumHasFlag(ISymbol symbol)
Copy link
Member

@genlu genlu Apr 21, 2020

Choose a reason for hiding this comment

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

check for IMethodSymbol?

Copy link
Member

@genlu genlu left a comment

Choose a reason for hiding this comment

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

:shipit:

@jasonmalinowski jasonmalinowski merged commit e9d748d into dotnet:master Apr 21, 2020
@ghost ghost added this to the Next milestone Apr 21, 2020
@jasonmalinowski jasonmalinowski deleted the allow-enum-preselection-in-hasflags branch April 21, 2020 23:42
@sharwell sharwell modified the milestones: Next, temp, 16.7.P1 Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants