Collection expression conversion failure should result in element-wise diagnostics #73297
Labels
Area-Compilers
Concept-Diagnostic Clarity
The issues deals with the ease of understanding of errors and warnings.
New Feature - Collection Expressions
untriaged
Issues and PRs which have not yet been triaged by a lead
SharpLab is out of date so you'll have to paste into a console app or similar.
Expected behavior: both cases report errors on the specific elements which are failing to convert.
Actual behavior: Argument to
M
gives an error on the entire collection-expr. One can imagine this being unwieldy for large collection-exprs. Only assignment toA[] arr
reports element-wise errors in the sample.It's possible that element-wise conversion errors are not always what we want. But, I am suggesting that we have consistency between conversion diagnostics for assignment and for argument conversions, as a baseline.
I think the reason for the current behavior with arguments has to do with the way overload resolution errors are reported. But it feels like even in overload cases, we should be able to report fine-grained diagnostics, when the candidate we choose for diagnostics doesn't have a conversion from collection-expr, and the parameter type is a collection type.
The text was updated successfully, but these errors were encountered: