Closed
Description
Similar to #97737, we should support more scenarios where we know a Type is an Enum type without emitting warnings.
The example scenario comes from https://github.com/microsoft/OpenAPI.NET/pull/1717/files#diff-c59c9153ccf5e00142826d1c5e4d3d92470aac0bc740a302a23557432141277c
public static T GetAttributeOfType<T>(this Enum enumValue) where T : Attribute
{
var type = enumValue.GetType();
var memInfo = type.GetField(enumValue.ToString(), BindingFlags.Public | BindingFlags.Static);
This code shouldn't warn because type
is guaranteed to be an Enum type.
This scenario was explicitly not supported in #105351. We should support it.
Metadata
Metadata
Assignees
Type
Projects
Status
No status