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

+= and friends do not count as mutated without reading #556

Open
Kampfkarren opened this issue Sep 25, 2023 · 1 comment
Open

+= and friends do not count as mutated without reading #556

Kampfkarren opened this issue Sep 25, 2023 · 1 comment
Labels
A-lints Area: Relating to a lint directly C-bug Category: Bug

Comments

@Kampfkarren
Copy link
Owner

local function test(x)
    x += 1
end

This counts x as used

@Kampfkarren Kampfkarren added C-bug Category: Bug A-lints Area: Relating to a lint directly labels Sep 25, 2023
@chriscerie
Copy link
Collaborator

chriscerie commented Sep 26, 2023

It's good to note fixing this could false positive if x implements some metamethod magic, but it's such a niche case it can probably be ignored.

Some more cases

Should remain marked as used

local function test(x)
    x.y += 1
end

Should not be marked as used

local x = {}
x.y += 1

Should remain marked as used

local x = a()
x.y += 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Relating to a lint directly C-bug Category: Bug
Projects
None yet
Development

No branches or pull requests

2 participants