Skip to content

Emit caller argument expression parameter name in correct casing#54642

Merged
jcouv merged 4 commits intodotnet:features/caller-argument-expressionfrom
Youssef1313:emit-correct-case
Jul 12, 2021
Merged

Emit caller argument expression parameter name in correct casing#54642
jcouv merged 4 commits intodotnet:features/caller-argument-expressionfrom
Youssef1313:emit-correct-case

Conversation

@Youssef1313
Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 commented Jul 6, 2021

Proposal: dotnet/csharplang#287
Test plan: #52745

@AlekseyTs @333fred for review

@Youssef1313 Youssef1313 requested a review from a team as a code owner July 6, 2021 21:49
@ghost ghost added the Area-Compilers label Jul 6, 2021
Copy link
Copy Markdown
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 3). @dotnet/roslyn-compiler for a second review.

@Youssef1313
Copy link
Copy Markdown
Member Author

@jcouv Can you review please? Thanks!

@jcouv jcouv self-assigned this Jul 12, 2021
Return MyBase.EarlyDecodeWellKnownAttribute(arguments)
End Function

Friend Overrides Iterator Function GetCustomAttributesToEmit(compilationState As ModuleCompilationState) As IEnumerable(Of VisualBasicAttributeData)
Copy link
Copy Markdown
Member

@jcouv jcouv Jul 12, 2021

Choose a reason for hiding this comment

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

Has the scenario where CallerArgumentExpressionAttribute is applied multiple times been considered (this requires to define a non-standard attribute)? The below code seems to assume only one usage.
As an example, for AsyncMethodBuilderAttribute only the first application is consisdered (the others are ignored).
This method and CallerArgumentExpressionParameterIndex probably need to agree on behavior (and not crash ;-).

Such situation could be combined with an application of the attribute using a different constructor (breaks assertion below). #Closed

Copy link
Copy Markdown
Member Author

@Youssef1313 Youssef1313 Jul 12, 2021

Choose a reason for hiding this comment

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

Has the scenario where CallerArgumentExpressionAttribute is applied multiple times been considered (this requires to define a non-standard attribute)? The below code seems to assume only one usage.
As an example, for AsyncMethodBuilderAttribute only the first application is consisdered (the others are ignored).
This method and CallerArgumentExpressionParameterIndex probably need to agree on behavior (and not crash ;-).

Applying multiple times is interesting. I'll add a test. Not sure if this scenario will need a warning?

Such situation could be combined with an application of the attribute using a different constructor (breaks assertion below).

I assumed this can't happen because the attribute description defines what constructor signature should it be:

internal static readonly AttributeDescription CallerArgumentExpressionAttribute = new AttributeDescription("System.Runtime.CompilerServices", "CallerArgumentExpressionAttribute", s_signatures_HasThis_Void_String_Only);

But definitely this worth a test.

@Youssef1313 Youssef1313 requested a review from jcouv July 12, 2021 06:14
Copy link
Copy Markdown
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 4)

@jcouv jcouv merged commit 4985da4 into dotnet:features/caller-argument-expression Jul 12, 2021
@jcouv
Copy link
Copy Markdown
Member

jcouv commented Jul 12, 2021

Merged/squashed. Thanks @Youssef1313 !

@jcouv
Copy link
Copy Markdown
Member

jcouv commented Jul 12, 2021

Just thought of something else given that @333fred said we'll be ready to merge this soon: We'll need to create a new language version for VB.

This could be done in this feature branch since that'll be the only VB feature.
Keeping with VB versioning history, this will be VB 17 (since shipping in dev17).
It'll be good to do an end-to-end manual test in IDE (create a project, use feature, upgrade LangVer, build/run).

FYI for @KathleenDollard

@Youssef1313 Youssef1313 deleted the emit-correct-case branch July 12, 2021 21:34
@Youssef1313
Copy link
Copy Markdown
Member Author

@jcouv I believe I already created a new language version in a previous PR.

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.

3 participants