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

RSRP-287324: Incorrect suggestion that type is never of the given type

$
0
0
Reporter Hans van Bakel (Hans.van.Bakel) Hans van Bakel (Hans.van.Bakel)
Created Dec 22, 2011 2:51:57 PM
Updated Feb 29, 2012 8:40:35 PM
Resolved Dec 22, 2011 6:13:37 PM
Priority Normal
Type Bug
Fix versions Next
State Fixed
Assignee Evgeny Pasynkov (pasynkov)
Subsystem Code Analysis - Find Code Issues
Affected versions 6.1
Fixed in build 6.5.1.1339
Given the following class structure:

public class Sub1 : Base<int>
    {
    }

public class Sub2 : Base<int>
{

}

public class Base<T>
{
public void Bla()
{
if (this as Sub1 != null || this is Sub2)
{
//
}
}
}

Resharper tells me that "this is Sub2" is never of the given type. This is incorrect as it's a subclass of Base<T>. This does work if the generic parmaters are removed. However this should work with generics as well.

I've used "x as Type != null" as a workaround but this gives the same result as the is operator.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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