Repository: dotnet/roslyn
File: src/Compilers/CSharp/Test/Semantic/Semantics/AmbiguousOverrideTests.cs (C#)

Code before:
            Console.WriteLine(""  *** Generic Non-ref"");

            EG<string> e = new EG<string>();
            string c = ""Hello"";

            e.F(c);
        }

        {
            Console.WriteLine(""  *** Generic-base Non-ref"");

            EGI e = new EGI();
            int c = 5;

            e.F(c);
        }

        Console.WriteLine(""***** End mod opt tests ****"");
    }
}
";
            CreateCompilationWithILAndMscorlib40(csharp, il).VerifyDiagnostics(
                // CONSIDER: Dev10 reports CS1957, even though the runtime has no trouble distinguishing the potentially
                // overridden methods.

                // (15,26): error CS0462: The inherited members 'CG<T>.F(T)' and 'CG<T>.F(T)' have the same signature in type 'EGI', so they cannot be overridden
                //     public override void F(int c)
                Diagnostic(ErrorCode.ERR_AmbigOverride, "F").WithArguments("CG<T>.F(T)", "CG<T>.F(T)", "EGI").WithLocation(15, 26),
                // (6,26): error CS0462: The inherited members 'CG<T>.F(T)' and 'CG<T>.F(T)' have the same signature in type 'EG<T>', so they cannot be overridden
                //     public override void F(T c)
                Diagnostic(ErrorCode.ERR_AmbigOverride, "F").WithArguments("CG<T>.F(T)", "CG<T>.F(T)", "EG<T>").WithLocation(6, 26),

                // NOTE: Dev10 doesn't report these cascading errors.

                // (9,14): error CS0121: The call is ambiguous between the following methods or properties: 'CG<T>.F(T)' and 'CG<T>.F(T)'
                //         base.F(c);
                Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("CG<T>.F(T)", "CG<T>.F(T)").WithLocation(9, 14),
                // (18,14): error CS0121: The call is ambiguous between the following methods or properties: 'CG<int>.F(int)' and 'CG<int>.F(int)'
                //         base.F(c);
                Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("CG<int>.F(int)", "CG<int>.F(int)").WithLocation(18, 14),
                // (34,15): error CS0121: The call is ambiguous between the following methods or properties: 'CG<string>.F(string)' and 'CG<string>.F(string)'
                //             e.F(c);
                Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("CG<string>.F(string)", "CG<string>.F(string)").WithLocation(34, 15),
                // (43,15): error CS0121: The call is ambiguous between the following methods or properties: 'CG<int>.F(int)' and 'CG<int>.F(int)'
                //             e.F(c);
                Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("CG<int>.F(int)", "CG<int>.F(int)").WithLocation(43, 15));
        }

        [ClrOnlyFact(ClrOnlyReason.Ilasm)]
        public void ModOptTest()
        {

Review comment (suggestion):
>// (6,26): error CS0462: The inherited members 'CG<T>.F(T)' and 'CG<T>.F(T)' have the same signature in type 'EG<T>', so they cannot be overridden [](http://example.com/codeflow?start=16&length=146)

Consider placing this error to its original position in the list to make the diff more informative. #Closed

Code after:
            Console.WriteLine(""  *** Generic Non-ref"");

            EG<string> e = new EG<string>();
            string c = ""Hello"";

            e.F(c);
        }

        {
            Console.WriteLine(""  *** Generic-base Non-ref"");

            EGI e = new EGI();
            int c = 5;

            e.F(c);
        }

        Console.WriteLine(""***** End mod opt tests ****"");
    }
}
";
            CreateCompilationWithILAndMscorlib40(csharp, il).VerifyDiagnostics(
                // CONSIDER: Dev10 reports CS1957, even though the runtime has no trouble distinguishing the potentially
                // overridden methods.

                // (6,26): error CS0462: The inherited members 'CG<T>.F(T)' and 'CG<T>.F(T)' have the same signature in type 'EG<T>', so they cannot be overridden
                //     public override void F(T c)
                Diagnostic(ErrorCode.ERR_AmbigOverride, "F").WithArguments("CG<T>.F(T)", "CG<T>.F(T)", "EG<T>").WithLocation(6, 26),
                // (15,26): error CS0462: The inherited members 'CG<T>.F(T)' and 'CG<T>.F(T)' have the same signature in type 'EGI', so they cannot be overridden
                //     public override void F(int c)
                Diagnostic(ErrorCode.ERR_AmbigOverride, "F").WithArguments("CG<T>.F(T)", "CG<T>.F(T)", "EGI").WithLocation(15, 26),

                // NOTE: Dev10 doesn't report these cascading errors.

                // (9,14): error CS0121: The call is ambiguous between the following methods or properties: 'CG<T>.F(T)' and 'CG<T>.F(T)'
                //         base.F(c);
                Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("CG<T>.F(T)", "CG<T>.F(T)").WithLocation(9, 14),
                // (18,14): error CS0121: The call is ambiguous between the following methods or properties: 'CG<int>.F(int)' and 'CG<int>.F(int)'
                //         base.F(c);
                Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("CG<int>.F(int)", "CG<int>.F(int)").WithLocation(18, 14),
                // (34,15): error CS0121: The call is ambiguous between the following methods or properties: 'CG<string>.F(string)' and 'CG<string>.F(string)'
                //             e.F(c);
                Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("CG<string>.F(string)", "CG<string>.F(string)").WithLocation(34, 15),
                // (43,15): error CS0121: The call is ambiguous between the following methods or properties: 'CG<int>.F(int)' and 'CG<int>.F(int)'
                //             e.F(c);
                Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("CG<int>.F(int)", "CG<int>.F(int)").WithLocation(43, 15));
        }

        [ClrOnlyFact(ClrOnlyReason.Ilasm)]
        public void ModOptTest()
        {