Closed krakovia-evm closed 18 hours ago
cc @grandizzy the easiest fix would be to skip adding fallback/receive if the body is empty as well but I don't know if this is right
cc @grandizzy the easiest fix would be to skip adding fallback/receive if the body is empty as well but I don't know if this is right
That makes sense, I overlooked empty body when enabled support for receive in https://github.com/foundry-rs/foundry/pull/9288
I am asking because we can register hits for empty functions but not receive/fallback, I would like to fix the underlying issue
ah, I see, I had the impression we already register hits for empty functions so my suggestion was to ignore empty receive/fallback only
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (7a23a5c 2024-12-01T00:29:03.740254700Z)
What command(s) is the bug in?
forge coverage
Operating System
Windows
Describe the bug
"forge coverage" seems to ignore receive() functions if their body is empty in tests. Simple poc
receive() external payable {}
to Counter.solwe should get 100% coverage, instead the receive function is red (but we touch it in the tests)
If i add an emit inside the receive() function it gets correctly (green) flagged.