Skip to content

Adjust required members visibility specification#6190

Merged
333fred merged 2 commits intodotnet:mainfrom
333fred:required-members-visibility
Jun 14, 2022
Merged

Adjust required members visibility specification#6190
333fred merged 2 commits intodotnet:mainfrom
333fred:required-members-visibility

Conversation

@333fred
Copy link
Copy Markdown
Member

@333fred 333fred commented Jun 1, 2022

The existing accessibility rules for required members allow protected members inside protected classes, breaking the intention of the rule. This update corrects the wording to prevent this.

@333fred 333fred requested a review from a team as a code owner June 1, 2022 21:17
The existing accessibility rules for required members allow protected members inside protected classes, breaking the intention of the rule. This update corrects the wording to prevent this.
@333fred 333fred force-pushed the required-members-visibility branch from 5c6b74d to a2483e4 Compare June 1, 2022 21:20
333fred added a commit to 333fred/roslyn that referenced this pull request Jun 1, 2022
@333fred 333fred requested review from RikkiGibson and jcouv June 1, 2022 23:16
Comment thread proposals/required-members.md Outdated
### Accessibility

It is an error to mark a member required if the member is less accessible than the member's containing type. The member must also be settable by consumers, meaning that:
It is an error to mark a member required if the member cannot be set in any context where the containing type is visible. The member must also be settable by consumers, meaning that:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: The member must also be settable by consumers seems redundant now.

@333fred 333fred merged commit 708ab77 into dotnet:main Jun 14, 2022
@333fred 333fred deleted the required-members-visibility branch June 14, 2022 17:35
333fred added a commit to dotnet/roslyn that referenced this pull request Jun 14, 2022
… enforcement (#61643)

* Calculate containing type effective accessibility for required member enforcement

Implements the spec change in dotnet/csharplang#6190. Fixes #61527 and #61528.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants