-
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
Allow enum preselection in Enum.HasFlag #43521
Allow enum preselection in Enum.HasFlag #43521
Conversation
It turns out the VB TypeInferrer tests never actually asserted the resulting type is the type that we expected.
|
...e/LanguageServices/TypeInferenceService/AbstractTypeInferenceService.AbstractTypeInferrer.cs
Outdated
Show resolved
Hide resolved
...e/LanguageServices/TypeInferenceService/AbstractTypeInferenceService.AbstractTypeInferrer.cs
Outdated
Show resolved
Hide resolved
fe601e3
to
a2c2116
Compare
This allows enum completion to correctly offer the enum options immediately which is likely what the user is trying to do.
a2c2116
to
f54cd3a
Compare
@@ -117,6 +117,12 @@ protected static IEnumerable<TypeInferenceInfo> GetCollectionElementType(INamedT | |||
|
|||
return SpecializedCollections.EmptyEnumerable<TypeInferenceInfo>(); | |||
} | |||
|
|||
protected static bool IsEnumHasFlag(ISymbol 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.
check for IMethodSymbol
?
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.
This enables preselection of the enum type if you're calling Enum.HasFlag:
@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.