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

RSRP-287494: 'Create from usage' should promote known constraints to base class and interfaces in created declaration

$
0
0
Reporter Vladimir Reshetnikov (nikov) Vladimir Reshetnikov (nikov)
Created Dec 30, 2011 1:41:28 AM
Updated Feb 9, 2012 9:15:45 PM
Priority Normal
Type Bug
Fix versions Mirabile Futurum
State Submitted
Assignee Alexey Kuptsov (alexey.kuptsov)
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
using System;

class A<T, S> where S : T { }

class Program
{
    static void Main()
    {
        new A<Exception, S>(); // Create S from usage
    }
}


Actual result:

using System;

class A<T, S> where S : T { }

class Program
{
    static void Main()
    {
        new A<Exception, S>(); // error CS0311: The type 'S' cannot be used as type parameter 'S' in the generic type or method 'A<T,S>'. There is no implicit reference conversion from 'S' to 'System.Exception'.
    }
}

internal class S
{
}


Expected:

using System;

class A<T, S> where S : T { }

class Program
{
    static void Main()
    {
        new A<Exception, S>(); // OK
    }
}

internal class S : Exception
{
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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