Skip to content

Suppress ref readonly warnings for collection initializers#69307

Merged
jjonescz merged 2 commits intodotnet:mainfrom
jjonescz:RefReadonly-23-CollectionInitializer
Aug 10, 2023
Merged

Suppress ref readonly warnings for collection initializers#69307
jjonescz merged 2 commits intodotnet:mainfrom
jjonescz:RefReadonly-23-CollectionInitializer

Conversation

@jjonescz
Copy link
Copy Markdown
Member

@jjonescz jjonescz commented Aug 1, 2023

Inspired by similar changes for interpolated string handlers and extension method receivers.
Speclet change: dotnet/csharplang@8e5c156
Test plan: #68056

@ghost ghost added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 1, 2023
@jjonescz jjonescz added the Feature - Ref Readonly Parameters `ref readonly` parameters label Aug 1, 2023
@jjonescz jjonescz requested a review from jcouv August 1, 2023 10:44
@jjonescz jjonescz marked this pull request as ready for review August 1, 2023 10:44
@jjonescz jjonescz requested a review from a team as a code owner August 1, 2023 10:44
Debug.Assert(addMethod.Parameters
.Skip(addMethod.IsExtensionMethod ? 1 : 0)
.All(p => p.RefKind == RefKind.None || p.RefKind == RefKind.In));
.All(p => p.RefKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note that this change is already included in parallel PR 8beb44d.

@jcouv jcouv self-assigned this Aug 1, 2023
Copy link
Copy Markdown
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)

@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 1, 2023
@jcouv jcouv added this to the 17.8 milestone Aug 1, 2023
@jjonescz
Copy link
Copy Markdown
Member Author

jjonescz commented Aug 2, 2023

@dotnet/roslyn-compiler for a second review, thanks

@jjonescz jjonescz enabled auto-merge (squash) August 10, 2023 08:12
@jjonescz jjonescz merged commit 525d095 into dotnet:main Aug 10, 2023
@jjonescz jjonescz deleted the RefReadonly-23-CollectionInitializer branch August 10, 2023 09:33
@ghost ghost modified the milestones: 17.8, Next Aug 10, 2023
@dibarbet dibarbet modified the milestones: Next, 17.8 P2 Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants