-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Error when required members are not set #60101
Error when required members are not set #60101
Conversation
Implements reading the required members list of a type, and enforces that required members are all set by an initializer on the constructor. Required members must be initialized with values, not with nested object initializers. Test plan dotnet#57046. Specification https://github.com/dotnet/csharplang/blob/main/proposals/required-members.md
@jcouv @RikkiGibson please take a look. |
As a general note, I scoured the codebase for other places where |
src/Compilers/CSharp/Test/Symbol/Symbols/RequiredMembersTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Show resolved
Hide resolved
* Support checking attribute constructors * Suppress some duplicate diagnostics * Minor other feedback.
@RikkiGibson addressed your feedback. Please take another look. |
@jcouv for a second review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review pass (iteration 2). Will look at tests this afternoon
…o enforce-setting * upstream/features/required-members: (78 commits) [main] Update dependencies from dotnet/roslyn (dotnet#59792) Annotate BreakpointSpans and fix NREs (dotnet#59846) Editor namespaces refactoring - part 1 (dotnet#59907) [main] Update dependencies from dotnet/source-build-externals (dotnet#59845) Update PublishData.json (dotnet#59952) ...and the comment Revert the last change in the compiler layer Force SVsExtensionManager to load before InProcComponent creation Handle nameof situation, moved logic back to workspaces layer Add back OmniSharpInlineHints (dotnet#59941) Initialize AsyncCompletionTracker in a fire-and-forget manner Try to load the extension manager from the main thread as well Use the correct GUID for SVsUserNotificationsService Update CodeStyle/format/SDK versions (dotnet#59903) Create attribute default arguments during binding (dotnet#59750) Undo refactoring part 2 Undo refactoring Move logic of symbol filtering to compiling layer. Refactoring Clean up diagnostic and solution crawler options - take 2 (dotnet#59233) Add quotes in string for clarity ...
Currently, ImmutableSegmentedDictionary cannot be used as a Sentinel value, because there is no way to make a sentinel that is different from Empty or default. This adds the ability to make a new empty dictionary, as well as a way to compare two ImmutableSegmentedDictionaries for reference equality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 6) with one test to consider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 7)
Implements reading the required members list of a type, and enforces that required members are all set by an initializer on the constructor. Required members must be initialized with values, not with nested object initializers.
Test plan #57046.
Specification https://github.com/dotnet/csharplang/blob/main/proposals/required-members.md