- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 273
Closed
Labels
Description
Product and Version Used:
When running the conversion for RCS1096 it incorrectly converts the HasFlag logic.  The current conversion treats composite flags as though HasFlag is identifying that any of the bits is set, where as in reality HasFlag will only return true if all bits are set.
Here is a sample program to demonstrate:
https://rextester.com/RENET59796
Steps to Reproduce:
given an enumeration and a variable x:
public enum MyFlags
{
    A = 1,
    B = 2,
    C = 4,
    D = 8,
    DA = D | A
}
var x = MyFlags.A | MyFlags.C;if I apply the fix for RCS1096 and code:
if(x.HasFlag(MyFlags.A|MyFlags.C))
{
    //...
}I get:
if((x & (MyFlags.A|MyFlags.C)) != 0)
{
    //...
}
When I would expect:
if((x & (MyFlags.A|MyFlags.C)) == (MyFlags.A|MyFlags.C))
{
    //...
}