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

Only record class can have a copy constructor. #68442

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

AlekseyTs
Copy link
Contributor

@AlekseyTs AlekseyTs commented Jun 5, 2023

Fixes #68345.

Relates to #65697

@AlekseyTs AlekseyTs requested review from jjonescz and cston June 5, 2023 15:40
@AlekseyTs AlekseyTs requested a review from a team as a code owner June 5, 2023 15:40
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Jun 5, 2023
@jcouv jcouv self-assigned this Jun 5, 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)

@@ -115,7 +115,7 @@ internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, r

internal static bool IsCopyConstructor(Symbol member)
{
if (member is MethodSymbol { ContainingType.IsRecordStruct: false, MethodKind: MethodKind.Constructor } method)
Copy link
Member

@jcouv jcouv Jun 5, 2023

Choose a reason for hiding this comment

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

On second thought, isn't this change affecting the behavior for a copy constructor in a record struct? Looking at the spec, there is no notion of copy constructor in record structs.

Never mind, IsRecord really means IsRecordClass. #Closed

@AlekseyTs
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@AlekseyTs
Copy link
Contributor Author

@cston, @jjonescz, @dotnet/roslyn-compiler Please review

@Kaifoij
Copy link

Kaifoij commented Jun 6, 2023

@Kaifoij
Copy link

Kaifoij commented Jun 6, 2023

2

@AlekseyTs AlekseyTs enabled auto-merge (squash) June 7, 2023 00:52
@AlekseyTs AlekseyTs merged commit 61853f2 into dotnet:main Jun 7, 2023
27 checks passed
@ghost ghost added this to the Next milestone Jun 7, 2023
@RikkiGibson RikkiGibson modified the milestones: Next, 17.7 P3 Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers New Feature - Primary Constructors 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.

Copy constructor should not be allowed to omit this initializer call in a type that is not a record
5 participants