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

Code before:
}
class Base2 : Base { }
class ImplicitInBase : Base2, I1<int, Int32> { }
class Explicit : I1<int, Int32>
{
    void I1<Int32, Int32>.Method<V>(int x, Func<int, int, V> v, int z) { }
    public void Method<V>(int x, Func<int, int, V> v, int z) { }
}
class Test
{
    public static void Main()
    {
        I1<int, int> i = new Implicit();
        Func<int, int, string> x = null;
        i.Method<string>(1, x, 1);

        i = new ImplicitInBase();
        i.Method<string>(1, x, 1);

        i = new Explicit();
        i.Method<string>(1, x, 1);
    }
}";

            CreateCompilation(source).VerifyDiagnostics(
// (20,27): warning CS0473: Explicit interface implementation 'Explicit.I1<int, int>.Method<V>(int, Func<int, int, V>, int)' matches more than one interface member. Which interface member is actually chosen is implementation-dependent. Consider using a non-explicit implementation instead.
//     void I1<Int32, Int32>.Method<V>(int x, Func<int, int, V> v, int z) { }
Diagnostic(ErrorCode.WRN_ExplicitImplCollision, "Method").WithArguments("Explicit.I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)").WithLocation(20, 27),
// (29,11): error CS0121: The call is ambiguous between the following methods or properties: 'I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)' and 'I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)'
//         i.Method<string>(1, x, 1);
Diagnostic(ErrorCode.ERR_AmbigCall, "Method<string>").WithArguments("I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)", "I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)").WithLocation(29, 11),
// (32,11): error CS0121: The call is ambiguous between the following methods or properties: 'I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)' and 'I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)'
//         i.Method<string>(1, x, 1);
Diagnostic(ErrorCode.ERR_AmbigCall, "Method<string>").WithArguments("I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)", "I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)").WithLocation(32, 11),
// (35,11): error CS0121: The call is ambiguous between the following methods or properties: 'I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)' and 'I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)'
//         i.Method<string>(1, x, 1);
Diagnostic(ErrorCode.ERR_AmbigCall, "Method<string>").WithArguments("I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)", "I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)").WithLocation(35, 11));
        }

        [Fact]
        public void TestImplementAmbiguousSignaturesFromSameInterface_Errors2()
        {
            var source = @"
using System;
interface I1<T, U>
{
    Action<T> Method(ref T x);
    Action<U> Method(U x); // Omit ref
    void Method(ref Func<U, T> v);
    void Method(out Func<T, U> v); // Toggle ref to out
    void Method(T x, U[] y);

Review comment (suggestion):
>System [](http://example.com/codeflow?start=100&length=6)

This change looks unexpected, it looks like the warning argument did not change. #Closed

Code after:
}
class Base2 : Base { }
class ImplicitInBase : Base2, I1<int, Int32> { }
class Explicit : I1<int, Int32>
{
    void I1<Int32, Int32>.Method<V>(int x, Func<int, int, V> v, int z) { }
    public void Method<V>(int x, Func<int, int, V> v, int z) { }
}
class Test
{
    public static void Main()
    {
        I1<int, int> i = new Implicit();
        Func<int, int, string> x = null;
        i.Method<string>(1, x, 1);

        i = new ImplicitInBase();
        i.Method<string>(1, x, 1);

        i = new Explicit();
        i.Method<string>(1, x, 1);
    }
}";

            CreateCompilation(source).VerifyDiagnostics(
// (20,27): warning CS0473: Explicit interface implementation 'Explicit.I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)' matches more than one interface member. Which interface member is actually chosen is implementation-dependent. Consider using a non-explicit implementation instead.
//     void I1<Int32, Int32>.Method<V>(int x, Func<int, int, V> v, int z) { }
Diagnostic(ErrorCode.WRN_ExplicitImplCollision, "Method").WithArguments("Explicit.I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)").WithLocation(20, 27),
// (29,11): error CS0121: The call is ambiguous between the following methods or properties: 'I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)' and 'I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)'
//         i.Method<string>(1, x, 1);
Diagnostic(ErrorCode.ERR_AmbigCall, "Method<string>").WithArguments("I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)", "I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)").WithLocation(29, 11),
// (32,11): error CS0121: The call is ambiguous between the following methods or properties: 'I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)' and 'I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)'
//         i.Method<string>(1, x, 1);
Diagnostic(ErrorCode.ERR_AmbigCall, "Method<string>").WithArguments("I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)", "I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)").WithLocation(32, 11),
// (35,11): error CS0121: The call is ambiguous between the following methods or properties: 'I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)' and 'I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)'
//         i.Method<string>(1, x, 1);
Diagnostic(ErrorCode.ERR_AmbigCall, "Method<string>").WithArguments("I1<int, int>.Method<V>(int, System.Func<int, int, V>, int)", "I1<int, int>.Method<Z>(int, System.Func<int, int, Z>, int)").WithLocation(35, 11));
        }

        [Fact]
        public void TestImplementAmbiguousSignaturesFromSameInterface_Errors2()
        {
            var source = @"
using System;
interface I1<T, U>
{
    Action<T> Method(ref T x);
    Action<U> Method(U x); // Omit ref
    void Method(ref Func<U, T> v);
    void Method(out Func<T, U> v); // Toggle ref to out
    void Method(T x, U[] y);