Skip to content

Commit

Permalink
Collection expressions: report specific conversion errors from overlo…
Browse files Browse the repository at this point in the history
…ad resolution
  • Loading branch information
cston committed May 2, 2024
1 parent 0c8ac4c commit 0eb7540
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
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);
}
else
{
// There's no symbol for the argument, so we don't need a SymbolDistinguisher.
Expand Down
Loading

0 comments on commit 0eb7540

Please sign in to comment.