meetings/2023/LDM-2023-08-07.md
https://github.com/dotnet/roslyn/issues/69222
The proposal is a possible improvement over the mechanism decided on July 24th, 2023, where the uniqueness of a method group that allows it to have a natural type is determined scope by scope rather than across all possible instance and extension methods.
In that proposal, an instance or extension method can still be considered to apply, even if it would later be rejected by subsequent checks. For instance, type arguments might not satisfy constraints:
var x = new C().M<int>; // CS8917 The delegate type could not be inferred.
public class C
{
public void M<T>() { }
public void M<T>(object o) where T : class { }
}
The proposal is to move these checks earlier, removing failing candidates so another candidate can be unique.
This additional pruning would cause us to depend on more details: It would succeed in more scenarios but at the cost of being more vulnerable to changes in those details. However, we accepted those same tradeoffs in method invocation scenarios several versions ago during a round of overload resolution improvements. This seems equivalent.
The proposal would incur slight breaking changes. They seem fairly negligible, but we should give it time in preview to confirm that we are not missing scenarios.
Change is approved. It will not be in C# 12, as we need bake time in preview to confirm that breaks are acceptable.