[Proposal]: Improve overload resolution for delegate compatibility
- Dominant language
- C#
- Stars
- 12.7k
- Forks
- 1.1k
- Avg merge
- 11h 1m
- Merged PRs (30d)
- 3
Description
# Improve overload resolution for delegate compatibility
* Specification: https://github.com/dotnet/csharplang/discussions/8614
* Discussion: https://github.com/dotnet/csharplang/discussions/8614
## Summary
[summary]: #summary
Improve overload resolution when looking for applicable methods by removing methods that cannot be compatible. This will allow the following code to compile (it does not today):
```cs
public class Program1
{
delegate void MyAction(T x);
void Y(long x) { }
void D(MyAction o) { }
void D(MyAction o) { }
void T()
{
D(Y); // Ambiguous between both D calls, despite the fact that `void D(MyAction)` is not a valid target.
}
}
```
## Design meetings
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.