Support caller info and nullability attributes in lambdas#64823
Closed
jjonescz wants to merge 1 commit intodotnet:features/lambda-default-parametersfrom
Closed
Support caller info and nullability attributes in lambdas#64823jjonescz wants to merge 1 commit intodotnet:features/lambda-default-parametersfrom
jjonescz wants to merge 1 commit intodotnet:features/lambda-default-parametersfrom
Conversation
Member
|
@cston wasn't it intentional that these weren't forwarded? |
AlekseyTs
reviewed
Oct 21, 2022
| ImmutableArray<TypeWithAnnotations> parameterTypes, | ||
| ImmutableArray<ConstantValue?> parameterDefaultValues) | ||
| ImmutableArray<ConstantValue?> parameterDefaultValues, | ||
| ImmutableArray<SourceComplexParameterSymbolBase> parameterSymbolsForAttributes) |
Contributor
AlekseyTs
reviewed
Oct 21, 2022
|
|
||
| public readonly ConstantValue? DefaultValue; | ||
|
|
||
| public readonly SourceComplexParameterSymbolBase? ParameterSymbolForAttributes; |
Contributor
AlekseyTs
reviewed
Oct 21, 2022
| } | ||
| """; | ||
| CompileAndVerify(source, expectedOutput: "file::member:0"); | ||
| CompileAndVerify(source, expectedOutput: "::Main:9"); |
Contributor
Contributor
Contributor
It looks like we're ignoring attributes when deciding whether to synthesize a delegate type or use Refers to: src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs:9038 in 8b663c3. [](commit_id = 8b663c3, deletion_comment = False) |
Member
I think the current behavior is intentional. We don't generally forward attributes (although we did an exception for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for
[CallerMemberName]+friends and[AllowNull]+friends in lambdas by forwarding them from a lambda declaration into its synthesized delegate type. In fact, with the proposed implementation, all well-known attributes forwarded bySynthesizedComplexParameterSymbolare supported.