dotnet/roslyn

CS0311 (cannot be used as type parameter) at wrong location

Open

#11.607 geöffnet am 27. Mai 2016

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-CompilersBugConcept-Diagnostic Clarityhelp wanted

Repository-Metriken

Stars
 (20.414 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

    class B<T1, T2>
        where T1 : B<T1, T2>.B1
        where T2 : B<T1, T2>.B2
    {
        public class B1 { }
        public class B2 { }
    }

    class D : B<D.D1, D.D2>
    {
        public class D1 { } // error expected here
        public class D2 : B2 { } // error shown here
    }

Actual CS0311 The type 'D.D1' cannot be used as type parameter 'T1' in the generic type or method 'B<T1, T2>'. There is no implicit reference conversion from 'D.D1' to 'B<D.D1, D.D2>.B1'. underlined D2

Expected: The same error but at D1 line.

Version: 2.0.0.60428

Contributor Guide