Skip to content

Fix RCS1169#1092

Merged
josefpihrt merged 4 commits into
dotnet:mainfrom
jamesHargreaves12:fix/RCS1169
Jun 1, 2023
Merged

Fix RCS1169#1092
josefpihrt merged 4 commits into
dotnet:mainfrom
jamesHargreaves12:fix/RCS1169

Conversation

@jamesHargreaves12

@jamesHargreaves12 jamesHargreaves12 commented May 30, 2023

Copy link
Copy Markdown
Contributor

Currently, RCS1169 will suggest setting variables to read-only in cases which would cause compile-time errors such as the following:

class C
{
    int _a;
    void M2() {M(ref _a!);} 
}

This is because when working out what symbols have values assigned to them outside a constructor it currently does not consider symbols that have the SuppressNullableWarning suffix (!).

There is another minor issue is that anything inside the ref expression is not being considered by the MakeMemberReadonlyWalker.

@josefpihrt josefpihrt merged commit bf2f6b8 into dotnet:main Jun 1, 2023
@josefpihrt

Copy link
Copy Markdown
Collaborator

Nice! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants