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

Filter RequiresLocationAttribute from ref readonly parameters #68870

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented Jul 4, 2023

Seems that PEParameterSymbol.GetAttributes() excludes IsReadOnlyAttribute for in parameters, so analogously, this PR makes ref readonly parameters exclude RequiresLocationAttribute.

Speclet: https://github.com/dotnet/csharplang/blob/cd336064a26a43c31c1164ef7cd3f5feb4420d20/proposals/ref-readonly-parameters.md
Test plan: #68056

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 4, 2023
@jjonescz jjonescz added New Feature - Ref Readonly Parameters `ref readonly` parameters Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead and removed Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 4, 2023
Assert.Empty(attribute.ConstructorArguments);
Assert.Empty(attribute.NamedArguments);
}
Assert.Empty(parameter.GetAttributes());
Copy link
Member Author

@jjonescz jjonescz Jul 4, 2023

Choose a reason for hiding this comment

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

Unfortunately, it means the presence of the attribute cannot be verified using compiler APIs anymore, I think. But it's still verified in the sense that it makes PEParameterSymbol.RefKind to be decoded correctly as RefReadonlyParameter if the attribute is present.

@jjonescz jjonescz marked this pull request as ready for review July 4, 2023 10:16
@jjonescz jjonescz requested a review from a team as a code owner July 4, 2023 10:16
@jjonescz jjonescz requested review from AlekseyTs and jcouv July 4, 2023 10:16
@jjonescz jjonescz added this to the C# 12.0 milestone Jul 4, 2023
Copy link
Contributor

@AlekseyTs AlekseyTs 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 1)

@jcouv jcouv self-assigned this Jul 7, 2023
Copy link
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 1)

@jjonescz jjonescz merged commit e3ed9a4 into dotnet:features/RefReadonly Jul 7, 2023
@jjonescz jjonescz deleted the RefReadonly-08-FilterAttribute branch July 7, 2023 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers New Feature - Ref Readonly Parameters `ref readonly` parameters 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.

3 participants