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

forge coverage does not use same settings as forge build #4921

Closed
2 tasks done
comunidadio opened this issue May 11, 2023 · 4 comments
Closed
2 tasks done

forge coverage does not use same settings as forge build #4921

comunidadio opened this issue May 11, 2023 · 4 comments
Labels
T-bug Type: bug

Comments

@comunidadio
Copy link

comunidadio commented May 11, 2023

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 (db96393 2023-05-11T00:10:51.773583000Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Apple Silicon)

Describe the bug

➜ forge git:(master) ✗ forge build
[⠆] Compiling...
[⠒] Compiling 26 files with 0.8.19
[⠰] Solc 0.8.19 finished in 10.18s
Compiler run successful!
➜ forge git:(master) ✗ forge coverage
[⠢] Compiling...
[⠒] Compiling 26 files with 0.8.19
[⠑] Solc 0.8.19 finished in 1.37s
Error:
Compiler run failed:
Error: Unimplemented feature (/solidity/libsolidity/codegen/ArrayUtils.cpp:228):Copying of type struct MyStruct memory[] memory to storage not yet supported.


Expected behavior: same successful compilation as with "forge build" as "forge coverage" should use the same settings (like "forge test" who does run fine).
Actual behavior: getting an "unimplemented feature" error.

Note that I do the get the same compilation error with "forge build" if I remove "via_ir = true" from my foundry.toml file, so I guess some build settings are not passed consistently to coverage build.

@comunidadio comunidadio added the T-bug Type: bug label May 11, 2023
@gakonst gakonst added this to Foundry May 11, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry May 11, 2023
@comunidadio
Copy link
Author

comunidadio commented May 11, 2023

I did try manually passing the option via "forge coverage --via-ir", same error.

Also just to confirm, "forge test" works fine with no issue as per "forge build".

@comunidadio comunidadio changed the title forge coverage does not support via-ir option from foundry.toml forge coverage does not support via-ir option May 11, 2023
@comunidadio comunidadio changed the title forge coverage does not support via-ir option forge coverage does not use same settings as forge build May 11, 2023
@PaulRBerg
Copy link
Contributor

Duplicate of #3527 (comment).

Also, see the discussion in #3978.

@PaulRBerg
Copy link
Contributor

If you want forge coverage to work, you will need to make your code compile even without --via-ir. See my tweet.

@comunidadio
Copy link
Author

Thanks for the tip @PaulRBerg. Refactored a bit and I managed to get coverage now.

@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

2 participants