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

RSRP-287685: 'Create method from usage' creates incompatible signature

$
0
0
Reporter Vladimir Reshetnikov (nikov) Vladimir Reshetnikov (nikov)
Created Jan 10, 2012 10:43:11 PM
Updated Jan 10, 2012 11:06:52 PM
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
using System;
using System.Collections.Generic;


class B<S>
{
    public virtual void Foo<T>(Dictionary<T, S> x)
    {
    }
}

class C : B<string>
{
    public override void Foo<T>(Dictionary<T, string> x)
    {
        Bar(x); // Create Bar from usage
    }
}


Actual:

using System;
using System.Collections.Generic;


class B<S>
{
    public virtual void Foo<T>(Dictionary<T, S> x)
    {
    }
}

class C : B<string>
{
    public override void Foo<T>(Dictionary<T, string> x)
    {
        Bar(x); // error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.Dictionary<T,string>' to 'System.Collections.Generic.Dictionary<object,string>'
    }

    private void Bar(Dictionary<object, string> dictionary)
    {
        throw new NotImplementedException();
    }
}


Expected:

using System;
using System.Collections.Generic;


class B<S>
{
    public virtual void Foo<T>(Dictionary<T, S> x)
    {
    }
}

class C : B<string>
{
    public override void Foo<T>(Dictionary<T, string> x)
    {
        Bar(x); // OK
    }

    private void Bar<T>(Dictionary<T, string> dictionary)
    {
        throw new NotImplementedException();
    }
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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