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

Collection expressions: report specific conversion errors from overload resolution #73307

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ internal bool TryGetCollectionIterationType(SyntaxNode syntax, TypeSymbol collec
{ WasCompilerGenerated = node.IsParamsArrayOrCollection, IsParamsArrayOrCollection = node.IsParamsArrayOrCollection };
}

private void GenerateImplicitConversionErrorForCollectionExpression(
internal void GenerateImplicitConversionErrorForCollectionExpression(
BoundUnconvertedCollectionExpression node,
TypeSymbol targetType,
BindingDiagnosticBag diagnostics)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,10 @@ private static bool HadLambdaConversionError(BindingDiagnosticBag diagnostics, A
{
// a diagnostic has been reported by ReportDelegateOrFunctionPointerMethodGroupDiagnostics
}
else if (argument.Kind == BoundKind.UnconvertedCollectionExpression)
{
binder.GenerateImplicitConversionErrorForCollectionExpression((BoundUnconvertedCollectionExpression)argument, parameterType, diagnostics);
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh! That was easy. :)

}
else
{
// There's no symbol for the argument, so we don't need a SymbolDistinguisher.
Expand Down