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

RSRP-285903: Method inlining changes code

$
0
0
Reporter Yuri Astrakhan (yurik) Yuri Astrakhan (yurik)
Created Dec 8, 2011 2:24:55 AM
Updated Dec 14, 2011 10:02:15 PM
Priority Major
Type Bug
Fix versions Mirabile Futurum
State Open
Assignee Sergey Shkredov (serjic.shkredov)
Subsystem No subsystem
Affected versions 6.1
Fixed in build No Fixed in build
int Foo()
{
    int x = new Random().Next();
    return x + 10;
}

private string Bar(string param)
{
    return param ?? Foo().ToString();    // <--- Inline method Foo()
}

private string BarActual(string param)   // <-- Result does not match the original
{
    int x = new Random().Next();
    return param ?? (x + 10).ToString();
}

private string BarExpected(string param) // <-- Expected result
{
    if (param == null)
    {
        int x = new Random().Next();
        return (x + 10).ToString();
    }
    else
        return param;
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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