Skip to content

Conversation

@hikarino-my
Copy link
Contributor

@hikarino-my hikarino-my commented Dec 30, 2019

As mentioned in #25476, writing to class member might have side-effect to other variable.
This PR treats write-only-access to a class member with setter as a reference, so noUnusedLocals warning won't appear on it.
This PR wouldn't change the accessKind of BinaryExpression, PrefixUnaryExpression, etc, which means "+= on private property" will still be treated as WriteOnlyAccess not ReadWriteAccess.

Fixes #25476

@sandersn
Copy link
Member

@weswigham the reviewers box is broken, but can you take a look at this too?

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me - assuming setters exist to do something side-effecty seems reasonable.

@sandersn sandersn merged commit f06f809 into microsoft:master Mar 12, 2020
sheetalkamat added a commit that referenced this pull request Mar 13, 2020
@hikarino-my hikarino-my deleted the fix25476 branch March 13, 2020 12:27
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

+= on private property doesn't count as a read for --noUnusedLocals

4 participants