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

Fix RCS1179 #1129

Merged
merged 11 commits into from
Jul 26, 2023
Merged

Fix RCS1179 #1129

merged 11 commits into from
Jul 26, 2023

Conversation

jamesHargreaves12
Copy link
Contributor

@jamesHargreaves12 jamesHargreaves12 commented Jul 24, 2023

If the field is explicitly defined this can cause implicit casting on assignment. In these cases explicitly returning rather than assigning (as RCS1179 suggests) would change the return type of the function (leading to the code not compiling) - see test code for examples.

This PR adds a check to prevent the diagnostic from being suggested if the return type doesn't exactly match the explicit type of the variable.

@jamesHargreaves12 jamesHargreaves12 changed the title Fix and test Fix RCS1179 Jul 24, 2023
@josefpihrt josefpihrt merged commit da508a5 into dotnet:main Jul 26, 2023
Haarmees pushed a commit to Haarmees/Roslynator that referenced this pull request Oct 30, 2023
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