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

Cannot parse some solc 0.6.x language features. #464

Closed
cgewecke opened this issue Dec 31, 2019 · 6 comments
Closed

Cannot parse some solc 0.6.x language features. #464

cgewecke opened this issue Dec 31, 2019 · 6 comments

Comments

@cgewecke
Copy link
Member

cgewecke commented Dec 31, 2019

Contracts which use new syntax crash the parser:

  • try/catch
  • override
  • array slicing
  • assembly leave
  • abstract keyword

Fixing this will require updates to the antlr grammar and solidity-parser-antlr.

Example error reported in gitter by cyril lapinte

interface/IERC20.sol
solidity-coverage cleaning up, shutting down ganache server
ParserError: Could not instrument: interface/IERC20.sol. 
(Please verify solc can compile this file without errors.) 
extraneous input 'abstract' expecting {<EOF>, 'pragma', 'import', 'contract', 'interface', 'library'} (9:0)
@cgewecke cgewecke changed the title Cannot parse solc 0.6.x language features. Cannot parse some solc 0.6.x language features. Dec 31, 2019
@nventuro
Copy link

nventuro commented Feb 6, 2020

From this comment, it looks like Consensys Dillegence took up maintenance of the antlr parser in their own fork.

It'd be great for coverage to upgrade and support 0.6, since migrating to this version is a complex process that could easily introduce errors (see the PR for the OpenZeppelin Contracts initial migration).

@cgewecke
Copy link
Member Author

cgewecke commented Feb 7, 2020

@nventuro

Ok, yes - will do this now and publish over the weekend. Was waiting a bit to see how things unfolded in parser-antlr but it looks like the diligence fork is the simplest way forward atm.

Is there a Zeppelin branch where you are no longer using the rotcivegaf fork of solidity-coverage?

@nventuro
Copy link

nventuro commented Feb 7, 2020

No, in the end we never got around to migrating to v7, sorry about that. The dev-v3.0 branch contains the 0.6 migration, and while it does use Test Environment, it does so in a very straightforward manner, using mocha with a single underlying ganache-core instance.

I suspect it wouldn't be too hard to support coverage in that scenario, the issues we found come up when we try to generalize the solution for any Test Environment setup, particularly those with parallel tests.

@cgewecke
Copy link
Member Author

cgewecke commented Feb 7, 2020

@nventuro

Oh no worries - I will just run the new parser over the contracts in dev-v3.0 to make sure it doesn't crash. Otherwise everything should be ok.

@cgewecke
Copy link
Member Author

Cross-ref note:

Looks like diligence resolved all the syntax issues listed in the initial comment. There's a problem parsing payable(<address>).

PR to resolve at consensys/solidity-antlr4 3

@cgewecke
Copy link
Member Author

With the caveat about payable(<address>) , this should be mostly fixed with 0.7.2

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

No branches or pull requests

2 participants