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

RSRP-288384: Always-true expression is not detected based on > operator

$
0
0
Reporter Vladimir Reshetnikov (nikov) Vladimir Reshetnikov (nikov)
Created Feb 19, 2012 1:09:03 AM
Updated Mar 28, 2012 6:35:27 PM
Resolved Mar 28, 2012 6:35:27 PM
Priority Normal
Type Bug
Fix versions 7.0
State Fixed
Assignee Evgeny Pasynkov (pasynkov)
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build

using System;

class Program
{
    static void Foo(object x, object y)
    {
        if (x as int? == 0)
        {
            if (x is int) // 'Expression is always true' is detected correctly
            {
                Console.WriteLine();
            }
        }

        if (y as int? > 0)
        {
            if (y is int) // 'Expression is always true' is not detected
            {
                Console.WriteLine();
            }
        }
    }
}


(y as int? > 0) implies (y as int? != null) and (x is int)

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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