Skip to content

Conversation

@AlekseyTs
Copy link
Contributor

Related to #73920.

@AlekseyTs AlekseyTs requested a review from a team as a code owner December 17, 2024 18:53
@ghost ghost added the untriaged Issues and PRs which have not yet been triaged by a lead label Dec 17, 2024
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review

@AlekseyTs AlekseyTs changed the base branch from main to features/GeneratedCodeAttributes December 18, 2024 16:59
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review


string source2 = @"
public record " + keyword + @" Test1(
[Preserve1]
Copy link
Contributor

Choose a reason for hiding this comment

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

[Preserve1]

Why isn't this attribute copied to the backing field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#73920 explicitly asks to not copy the attribute for records:

Cases where attributes should not flow:

  • Primary constructor parameters of record types: the compiler allows adding [property: ...] annotations to primary constructor parameters of record types ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A user is able to explicitly apply attributes to backing fields in records

@AlekseyTs AlekseyTs requested a review from cston December 18, 2024 22:02
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review

@AlekseyTs AlekseyTs requested a review from a team December 19, 2024 14:42
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review

@AlekseyTs AlekseyTs merged commit cf5eed2 into dotnet:features/GeneratedCodeAttributes Dec 20, 2024
28 checks passed
checkedsums pushed a commit to checkedsums/roslynjourneys that referenced this pull request Jan 5, 2025
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.

3 participants