Add support for nominal records#44774
Merged
agocke merged 1 commit intodotnet:features/recordsfrom Jun 2, 2020
Merged
Conversation
RikkiGibson
approved these changes
Jun 1, 2020
| hasInstanceConstructor = true; | ||
| hasParameterlessInstanceConstructor = hasParameterlessInstanceConstructor || method.ParameterCount == 0; | ||
| // Ignore the record copy constructor | ||
| if (!(method is SynthesizedRecordCopyCtor)) |
Member
There was a problem hiding this comment.
Can we check 'method.IsImplicitlyDeclared' here instead?
Member
Author
There was a problem hiding this comment.
That's true for all SynthesizedInstanceMethodSymbols, including the record primary constructor, unfortunately
jcouv
reviewed
Jun 2, 2020
| { | ||
| var comp = CreateCompilation(@" | ||
| #nullable enable | ||
| data class C |
Member
There was a problem hiding this comment.
Please add a test for data class C(). From your PR description, I'm not sure what is expected (allowed or not?)
Update: I see that is covered in EmptyRecord in the other test file. #Closed
Member
Author
There was a problem hiding this comment.
Right the absence of a record parameter list is not the same as an empty record parameter list. Right now it's an error.
jcouv
reviewed
Jun 2, 2020
| } | ||
|
|
||
| var ctor = addCtor(paramList); | ||
| // Positional record |
Member
There was a problem hiding this comment.
Positional record [](start = 15, length = 17)
nit: positional members?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the requirement for a record to have a parameter list