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

Integrate Lambda Default Parameters into Synthesized Delegate Types and Lowering Pass #63293

Merged
merged 25 commits into from
Aug 16, 2022

Conversation

adamperlin
Copy link
Contributor

Allows default values to be attached to the parameters of synthesized delegate types and threaded through the closure lowering pass in order to support code-gen for lambda default parameters.

Still missing (will be added in a subsequent PR):

  • Diagnostics for invalid target-type conversions between lambdas with default parameters and delegate types
  • Synthesizing delegate types for method groups with default parameters (and associated conversion warnings)

@adamperlin adamperlin requested review from 333fred and cston August 9, 2022 23:00
@adamperlin adamperlin requested a review from a team as a code owner August 9, 2022 23:00
Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

Done review pass (commit 7)

…tor to follow convention from source parameter symbols"

This reverts commit 26375e1.
Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

Done review pass. Just a couple of small things.

@cston
Copy link
Member

cston commented Aug 12, 2022

                parameterDefaultValueBuilder.Add(constVal);

Consider moving this after the if (constVal != null) { ... } check, essentially moving a version of the if below here, to avoid needing the comment.

if (constVal != null && parameterDefaultValueBuilder == null)
{
    parameterDefaultValueBuilder = ... // allocate and fill
}
if (parameterDefaultValueBuilder != null)
{
    parameterDefaultValueBuilder.Add(constVal);
}

In reply to: 1213551892


Refers to: src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs:664 in 8254fca. [](commit_id = 8254fca, deletion_comment = False)

adamperlin and others added 2 commits August 15, 2022 13:44
… for synthesized parameter and default value for _baseParameterForAttributes
…odBaseSymbol.cs

Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
@adamperlin adamperlin requested a review from 333fred August 15, 2022 21:05
Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

Done review pass. Overall looking good, but test failure needs to be addressed.

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

LGTM (commit 21), assuming tests are passing.

@adamperlin adamperlin merged commit 11972ed into dotnet:features/lambda-default-parameters Aug 16, 2022
@Youssef1313 Youssef1313 mentioned this pull request Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants