Skip to content

Coverage: could not find anchor error thrown if function is empty  #2471

Closed
@varunsrin

Description

@varunsrin

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
    Foundryup

What version of Foundry are you on?

forge 0.2.0 (64fe4ac 2022-07-25T00:20:31.96755Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Apple Silicon)

Describe the bug

forge coverage fails with an error if it encounters an empty function call in a contract. Should it simply show coverage as 0.00% instead and succeed?

It isn't a major issue, since once you see the error and inspect the code, it's fairly obvious what's causing it and you probably shouldn't have empty functions anyway.

You can test it by running it against this contract. (cc @onbjerg )

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.15;

contract ForgeCovErrorRepro {
    function doNothing() public {}
}

Activity

moved this to Todo in Foundryon Jul 25, 2022
onbjerg

onbjerg commented on Jul 25, 2022

@onbjerg
Collaborator

Yeah this is known, thought there was another issue for it

added this to the v1.0.0 milestone on Jul 25, 2022
self-assigned this
on Jul 25, 2022
moved this from Todo to In Progress in Foundryon Jul 25, 2022
linked a pull request that will close this issuefix: various coverage fixes #2504on Jul 28, 2022
Repository owner moved this from In Progress to Done in Foundryon Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Relationships

None yet

    Development

    Participants

    @varunsrin@onbjerg

    Issue actions

      Coverage: could not find anchor error thrown if function is empty · Issue #2471 · foundry-rs/foundry