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

ParserError solidity-coverage: v0.8.5 Solidity 0.8.19 #821

Closed
ohaponiuk opened this issue Nov 29, 2023 · 3 comments
Closed

ParserError solidity-coverage: v0.8.5 Solidity 0.8.19 #821

ohaponiuk opened this issue Nov 29, 2023 · 3 comments
Labels

Comments

@ohaponiuk
Copy link

PoC:

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

contract Test {
    function test() external {
        int i = 0;
        if (false) {} else i == 0 ? i = 0 : i--;
    }
}

Result:

❯ npx hardhat coverage

Version
=======
> solidity-coverage: v0.8.5

Instrumenting for coverage...
=============================

> Test.sol

Compilation:
============

ParserError: Expected ',' but got ';'
  --> contracts/Test.sol:22:51:
   |
22 |             else {((c_e76f6567(0x46bcacc667e80bd0); /* branch */ 
   |                                                   ^


Error in plugin solidity-coverage: HardhatError: HH600: Compilation failed

For more info run Hardhat with --show-stack-traces
@cgewecke cgewecke added the bug label Jan 11, 2024
@cgewecke cgewecke mentioned this issue Jan 11, 2024
14 tasks
@PfanP
Copy link

PfanP commented Jan 24, 2024

Is there any progress on this issue?

@cgewecke
Copy link
Member

@PfanP Will take a look at this asap. It's possible you could work around this error by explicitly bracketing the else, e.g rewriting the original example like:

contract Test {
    function test() external {
        int i = 0;
        if (false) {
        } else {
           i == 0 ? i = 0 : i--;
       }
    }
}

If that fails, as a last resort you should be able to use conventional if/else for the ternary conditional.

@cgewecke
Copy link
Member

Fixed in v.0.8.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants