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

RSRP-124348: Provide QF for warning 'Access to base from lambda' - Extract method

$
0
0
Reporter Vladimir Reshetnikov (nikov) Vladimir Reshetnikov (nikov)
Created Oct 8, 2009 12:01:14 AM
Updated Apr 30, 2012 12:48:10 AM
Priority Critical
Type Feature
Fix versions 6.1
State Open
Assignee eugene legkiy (jenya.legkiy)
Subsystem Quick Fixes
Affected versions No Affected versions
Fixed in build No Fixed in build
using System.Collections.Generic;
using System.Linq;

class A
{
    public virtual bool Foo(string s, int y)
    {
        return false;
    }
}

class B : A
{
    public override bool Foo(string s, int y)
    {
        return true;
    }

    bool Bar(IEnumerable<string> x, int y)
    {
        return x.Any(s => base.Foo(s, y)); // here
    }
}


Expected result:

using System.Collections.Generic;
using System.Linq;

class A
{
    public virtual bool Foo(string s, int y)
    {
        return false;
    }
}

class B : A
{
    public override bool Foo(string s, int y)
    {
        return true;
    }

    bool Bar(IEnumerable<string> x, int y)
    {
        return x.Any(s => NewMethod(s, y));
    }

    private bool NewMethod(string s, int y) // Provide hot spot for the method name
    {
        return base.Foo(s, y);
    }
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles