Skip to content

Conversation

@j3parker
Copy link
Member

No description provided.

with:
dotnet-version: |
7.0.x
9.0.x
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to update for new C# 12 syntax

@j3parker j3parker changed the title Add support for CollectionExpression in async generator LFT-1728 - Add support for CollectionExpression in async generator May 28, 2025
@j3parker j3parker marked this pull request as ready for review May 28, 2025 21:02
@j3parker j3parker requested a review from omsmith as a code owner May 28, 2025 21:02
@j3parker j3parker requested a review from sgrinwis-d2l May 28, 2025 21:02
SpreadElementSyntax sp => sp.WithExpression( Transform( sp.Expression ) ),
_ => UnhandledSyntax( elem )
} ),
original.GetSeparators()
Copy link
Contributor

Choose a reason for hiding this comment

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

We're not passing the original separators for the other cases in the transformer, so perhaps something to correct later

Copy link
Member Author

@j3parker j3parker May 28, 2025

Choose a reason for hiding this comment

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

Yeah -- see note below.

One other reason we're not doing it in the other ones is TransformAll supports the "maybe transform" e.g. so we can delete cancellation token arguments. There needs to be some accounting for that otherwise .GetSeparators() will possibly insert extra separators/commas, so it needs a bit more thought.

Comment on lines +361 to +365
original.Select( elem => elem switch {
ExpressionElementSyntax ee => ee.WithExpression( Transform( ee.Expression ) ),
SpreadElementSyntax sp => sp.WithExpression( Transform( sp.Expression ) ),
_ => UnhandledSyntax( elem )
} ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Particular reason this isn't just original.Select( Transform ) or something, with the top-level Dispatch handling Spread?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah -- what I have currently on my desktop has that, with the move to TransformAll. I'll get to it.

_ => UnhandledSyntax( elem )
} ),
original.GetSeparators()
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Actually part of this is already in place with the TransformAll combinator.
It doesn't do original.GetSeparators(), though.

I'll do a follow-up PR to switch to that, but also add the separators. That will incur some noise because we will have to fix up the whitespace in unrelated tests.

@j3parker j3parker merged commit b5e232f into main May 28, 2025
2 checks passed
@j3parker j3parker deleted the async-collection-syntax branch May 28, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants