Apologies if this is a dupe; I don't see another issue like this.
Please allow the following. I see no possible ambiguity in this scenario. TheIsEven and Test method groups have only one overload which fits the delegate signature.
```c#
class Program
{
public static void Main()
{
Test(IsEven);
}
public static bool IsEven(int x) => x % 2 == 0;
public static void Test<T>(Func<T, bool> predicate)
{
}
}
```
Expected Behavior:
Infers Test<int>(IsEven) and compiles
Actual Behavior:
CS0411 The type arguments for method 'Program.Test
Believe this is by design but will let @gafter comment on exactly how.
Type inference doesn't infer based on an argument that is a method group, no matter how many or few members the method group has. The conversion from a method group to a delegate (of some particular type) occurs after type inference has completed to determine what that delegate type is.
Having said that, I imagine it might be possible to modify (the specification for) type inference to get the behavior @jnm2 would like. Who would like to take a crack at it?
@gafter Should I move this to csharplang?
@jnm2 Sure, if you'd like to discuss it further. But without a suggestion as to how it would work, I don't see how it can move past the discussion phase. Perhaps that discussion will trigger an idea in someone's head?
Issue moved to dotnet/csharplang #129 via ZenHub
Most helpful comment
Type inference doesn't infer based on an argument that is a method group, no matter how many or few members the method group has. The conversion from a method group to a delegate (of some particular type) occurs after type inference has completed to determine what that delegate type is.
Having said that, I imagine it might be possible to modify (the specification for) type inference to get the behavior @jnm2 would like. Who would like to take a crack at it?