dotnet / dotnet/csharpstandard

12.6.4.1 & 12.7.6.2: Overloading resolution is too simple, so let's make it repeat steps...

Open
#163 3 comments 0 reactions 0 assignees View on GitHub
type: clarity
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

From §13.6.4.1 (Overloading Resolution – General):

> - First, the set of candidate function members is reduced to those function members that are applicable with respect to the given argument list (§13.6.4.2).

From §13.7.6.2 (Method invocations):

> - The set of candidate methods for the method invocation is constructed. For each method `F` associated with the method group `M`:
> - If `F` is non-generic, `F` is a candidate when:
- `M` has no type argument list, and
- `F` is applicable with respect to `A` (§13.6.4.2).

So the candidates are reduced to those that are applicable, but a method is only a candidate if it is applicable...

This longstanding bit of fun came up as an issue when trying to improve the wording of the non-ambiguous ambiguity example covered by ECMA-TC49-TG2/spec#776.

We probably really need something like a clear progression "candidate -> applicable -> best", maybe in the "pre C# 6" phase?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.