Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcomings in computing diagnostics for extension methods #24787

Open
gafter opened this issue Feb 12, 2018 · 0 comments
Open

Shortcomings in computing diagnostics for extension methods #24787

gafter opened this issue Feb 12, 2018 · 0 comments
Labels
Area-Compilers Bug Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@gafter
Copy link
Member

gafter commented Feb 12, 2018

I was recently implementing support for dotnet/csharplang#98 and discovered a regression in the quality of diagnostic for the situation in test DelegatesFromInvalidOverloads.

It is caused by a combination of two shortcomings in the computation of diagnostics. First, in BindExtensionMethod when we fail to find an applicable extension method, we only report a diagnostic for the first extension method group that failed, even if some other extension method group contains a much better candidate. In the case of this test the first extension method group contains a method with the wrong number of parameters, while the second one has an extension method that fails only because of its return type mismatch.

Second, in OverloadResolutionResult<TMember>.ReportDiagnostics<T>, we do not report a diagnostic for the failure MemberResolutionKind.NoCorrespondingParameter, leaving it to the caller to notice that we failed to produce a diagnostic (the caller has to grub through the diagnostic bag to see that there is no error there) and then the caller has to produce a generic error message, which we see below. It does not appear that all callers have that test, though, suggesting there may be a latent bug of missing diagnostics.

@gafter gafter added Bug Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality labels Feb 12, 2018
@gafter gafter added this to the Unknown milestone Feb 12, 2018
@gafter gafter added the help wanted The issue is "up for grabs" - add a comment if you are interested in working on it label Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
None yet
Development

No branches or pull requests

1 participant