Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-288344: 'Expression is always false' for comparison with certain combinations of enum flags

$
0
0
Reporter Vladimir Reshetnikov (nikov) Vladimir Reshetnikov (nikov)
Created Feb 16, 2012 5:38:08 AM
Updated Feb 16, 2012 5:38:08 AM
Priority Normal
Type Feature
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
using System.Threading;

class C
{
    static void Foo(Thread thread)
    {
        if(thread.ThreadState == (ThreadState.Unstarted | ThreadState.Aborted)) // Expression is always false
        {
        }
    }
}


Probable user's intention (which can be suggested by ReSharper as a QF):

class C
{
    static void Foo(Thread thread)
    {
        if(thread.ThreadState == ThreadState.Unstarted | thread.ThreadState == ThreadState.Aborted)
        {
        }
    }
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>