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

Avoid giving 'no best type' error when one of the types contains error types #68991

Merged
merged 5 commits into from
Jul 19, 2023

Conversation

RikkiGibson
Copy link
Contributor

@RikkiGibson RikkiGibson commented Jul 11, 2023

Closes #67751

Moving to draft while I build out the test coverage.

@RikkiGibson RikkiGibson requested a review from a team as a code owner July 11, 2023 21:47
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 11, 2023
@RikkiGibson RikkiGibson marked this pull request as draft July 11, 2023 22:02
@RikkiGibson RikkiGibson marked this pull request as ready for review July 18, 2023 21:44
@jaredpar jaredpar added this to the 17.8 milestone Jul 18, 2023

public class C {
public void M0() {
Func<bool, int> fn1 = flag =>
Copy link
Member

@jcouv jcouv Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also include a lambda scenario without target-type (ie. var fn = ...)? #Closed

Diagnostic(ErrorCode.ERR_ImplicitlyTypedArrayNoBestType, "new[] { x1, y1 }").WithLocation(5, 18),
// (7,18): error CS0826: No best type found for implicitly-typed array
Diagnostic(ErrorCode.ERR_NoImplicitConv, "x1").WithArguments("C", "Unknown?").WithLocation(5, 26),
// 0.cs(7,30): error CS0029: Cannot implicitly convert type 'C' to 'Unknown?'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking this PR: should we also prevent this cascading diagnostic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a good idea. Opening #69138.

@jcouv jcouv self-assigned this Jul 18, 2023
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 2) with a question and a test suggestion to consider

@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label Jul 18, 2023
@RikkiGibson RikkiGibson merged commit ea6cc9a into dotnet:main Jul 19, 2023
25 checks passed
@RikkiGibson RikkiGibson deleted the best-type-nested-errortype branch July 19, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't produce a "best type not found" error because of an ErrorType in a nested position
4 participants