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 expression arguments: initial binding and lowering #76903

Draft
wants to merge 18 commits into
base: features/dictionary-expressions
Choose a base branch
from

Conversation

cston
Copy link
Member

@cston cston commented Jan 24, 2025

Binding and lowering of collection expression arguments for class and struct target types that implement IEnumerable and do not have a [CollectionBuilder] attribute.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 24, 2025
@@ -6841,6 +6841,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="IDS_FeatureCollectionExpressions" xml:space="preserve">
<value>collection expressions</value>
</data>
<data name="IDS_FeatureCollectionExpressionArguments" xml:space="preserve">
<value>collection expression arguments</value>
</data>
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Jan 24, 2025

Choose a reason for hiding this comment

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

Grrrr #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, these two resource strings are essentially the ones you added and removed from #76003.

@@ -6880,6 +6883,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="ERR_CollectionExpressionKeyValuePairNotSupported" xml:space="preserve">
<value>Collection expression type '{0}' does not support key-value pair elements.</value>
</data>
<data name="ERR_CollectionArgumentsMustBeFirst" xml:space="preserve">
<value>Collection arguments must be the first element.</value>
</data>
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Jan 24, 2025

Choose a reason for hiding this comment

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

Grr * 2.

Note i think this should be called "collection argument element" or just "'with' element. Saying the arguments (plural) must be the first element (singular) reads oddly to me. #Resolved

{
internal partial class BoundUnconvertedCollectionArguments
{
internal void GetArguments(AnalyzedArguments analyzedArguments)
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Jan 24, 2025

Choose a reason for hiding this comment

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

fwiw, havin thtis be called GetArguments and not return something reads oddly. Consider .AddArgumentsTo, which makes it much clearer that the receiver is adding the arguments to the passed in value. #ByDesign

Copy link
Member Author

@cston cston Jan 24, 2025

Choose a reason for hiding this comment

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

I'd like to leave this as is. The intended use is to populate the AnalyzedArguments collection with just the arguments, rather than to add to an existing collection (we assert the collection is empty initially), so renaming to AddArgumentsTo might make the intent less clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants