Open tmds opened 5 years ago
Version Used: master
Steps to Reproduce:
using System; using System.Threading.Tasks; public class C { public void M() { AcceptMethod(Foo); AcceptMethod(Bar); AcceptMethod(Bazz); } public int Foo() { return 0; } public void Bar() {} public void Bazz(string s1, String s2, int i) { } public static void AcceptMethod<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, Task<int>> action) {} public static void AcceptMethod<T1, T2, T3, T4>(Func<T1, T2, T3, T4, Task<int>> action) {} public static void AcceptMethod<T1, T2, T3>(Func<T1, T2, T3, Task<int>> action) {} public static void AcceptMethod<T1, T2>(Func<T1, T2, Task<int>> action) {} public static void AcceptMethod<T>(Func<T, Task<int>> action) {} public static void AcceptMethod(Func<Task<int>> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, Task> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, Task> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, Task> action) {} public static void AcceptMethod<T1, T2, T3, T4>(Func<T1, T2, T3, T4, Task> action) {} public static void AcceptMethod<T1, T2, T3>(Func<T1, T2, T3, Task> action) {} public static void AcceptMethod<T1, T2>(Func<T1, T2, Task> action) {} public static void AcceptMethod<T>(Func<T, Task> action) {} public static void AcceptMethod(Func<Task> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, Task<int>> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, int> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, int> action) {} public static void AcceptMethod<T1, T2, T3, T4>(Func<T1, T2, T3, T4, int> action) {} public static void AcceptMethod<T1, T2, T3>(Func<T1, T2, T3, int> action) {} public static void AcceptMethod<T1, T2>(Func<T1, T2, int> action) {} public static void AcceptMethod<T>(Func<T, int> action) {} public static void AcceptMethod(Func<int> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action) {} public static void AcceptMethod<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action) {} public static void AcceptMethod<T1, T2, T3>(Action<T1, T2, T3> action) {} public static void AcceptMethod<T1, T2>(Action<T1, T2> action) {} public static void AcceptMethod<T>(Action<T> action) {} public static void AcceptMethod(Action action) {} public static void AcceptMethod<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, int> action) {} public static void AcceptMethod<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, Task<int>> action) {} }
Expected Behavior:
Program should compile.
Actual Behavior: AcceptMethod(Bazz) generates error:
AcceptMethod(Bazz)
error CS1503: Argument 1: cannot convert from 'method group' to 'Func<Task>'
error CS1503: Argument 1: cannot convert from 'method group' to 'Func'
My expectation was that all overloads of AcceptMethod would be considered. But I realize now that C# probably doesn't do that.
Version Used: master
Steps to Reproduce:
Expected Behavior:
Program should compile.
Actual Behavior:
AcceptMethod(Bazz)
generates error: