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

Allow accessing ref fields through rvalues #75316

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented Oct 1, 2024

Fixes #75082.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 1, 2024
@jjonescz jjonescz marked this pull request as ready for review October 1, 2024 15:15
@jjonescz jjonescz requested a review from a team as a code owner October 1, 2024 15:15
// ref/out access to a ref field is fine regardless of the receiver
return true;
case RefKind.RefReadOnly:
ReportReadOnlyError(fieldSymbol, node, valueKind, checkingReceiver, diagnostics);
Copy link
Contributor

@AlekseyTs AlekseyTs Oct 1, 2024

Choose a reason for hiding this comment

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

ReportReadOnlyError(fieldSymbol, node, valueKind, checkingReceiver, diagnostics);

Are we testing this code path? #Closed

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, this is unreachable code because there is an if (RequiresAssignableVariable(valueKind)) above which subsumes this one.

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)

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 2)

@jjonescz jjonescz merged commit 0d41e66 into dotnet:main Oct 3, 2024
24 checks passed
@jjonescz jjonescz deleted the 75082-RefThroughValue branch October 3, 2024 08:52
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Oct 3, 2024
@akhera99 akhera99 modified the milestones: Next, 17.13 P1 Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers 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.

Possibly unexpected error when a ref field is passed as an argument
5 participants