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

RSRP-294502: Rename refactoring fails to resolve a conflict in anonymous type and breaks code

$
0
0
Reporter Vladimir Reshetnikov (nikov) Vladimir Reshetnikov (nikov)
Created Apr 14, 2012 7:52:26 AM
Updated Apr 14, 2012 7:52:26 AM
Priority Normal
Type Bug
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
class C
{
    static void Bar()
    {
        var obj = new { x = 1 };
        var x = 1; // Rename local variable x to y
        var z = Foo(obj, new {x}).ToLower();
    }

    static string Foo<T>(T x, T y) { return ""; }
    static void Foo(object x, object y) { }
}


Actual:

class C
{
    static void Bar()
    {
        var obj = new { x = 1 };
        var y = 1;
        var z = Foo(obj, new { y }).ToLower(); // error CS0023: Operator '.' cannot be applied to operand of type 'void'
    }

    static string Foo<T>(T x, T y) { return ""; }
    static void Foo(object x, object y) { }
}


Expected:

class C
{
    static void Bar()
    {
        var obj = new { x = 1 };
        var y = 1;
        var z = Foo(obj, new { x = y }).ToLower(); // OK
    }

    static string Foo<T>(T x, T y) { return ""; }
    static void Foo(object x, object y) { }
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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