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

Improve tuple analysis for unused-return detector #1861

Merged
merged 1 commit into from
May 15, 2023

Conversation

smonicas
Copy link
Contributor

Now if a function call returns multiple values all must be used. Before it was enough to use only 1 value and this detector wouldn't detect the other unused.

        // Detected as unused return
        (uint e,) = t.g();

@0xalpharush
Copy link
Contributor

0xalpharush commented Apr 25, 2023

There's not really a great way for a user to fix this detector result because if the variable is not needed, adding it will create an unused local.


User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#18-37) ignores return value by t.g() (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#31)

User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#18-37) ignores return value by (e) = t.g() (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#36)
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good if we could get this to display as (e, ) = t.g() so it's clear what is being ignored

Copy link
Member

Choose a reason for hiding this comment

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

I agree, but this should be done in a separate PR

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.

3 participants