-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
bug: coverage report misses return-declared variables if returned as-is #7476
Comments
Hi @stevieraykatz thanks for reporting this I'm able to reproduce the bug, added a runnable repro here: https://github.com/zerosnacks/foundry-bug-7476-repro |
yep, that's similar with #4311 where no-effect statements ( |
A PR was made for this edge case, however per comment here #8442 (comment) there are other ways to replicate same behavior. Fixing all these scenarios will introduce code complexity that we'd rather avoid. More, having coverage reporting such lines should contribute to keeping code clean. We ack the limitation and close this as won't fix, please reopen if you think it's something critical and should be addressed. Thank you! |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (545cd0b 2024-03-14T00:20:00.210934000Z)
What command(s) is the bug in?
forge coverage
Operating System
macOS (Apple Silicon)
Describe the bug
If a variable is defined as part of a return statement and then returns uninitialized, foundry coverage misses this. I found this issue when improving test coverage for this method in ERC1271.sol. It was trivial to recreate this issue in a stripped down experiment:
Contract
Test
Coverage report
where lines 8 and 9 refer to
b = b;
andc = c;
in methodnotCovered()
.The text was updated successfully, but these errors were encountered: