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

Non-ascii chars cause compilation failure, (inserting else branch in the wrong place) #418

Open
boolafish opened this issue Oct 3, 2019 · 1 comment

Comments

@boolafish
Copy link

boolafish commented Oct 3, 2019

What

Somehow the coverage tool inserts the else in wrong place and make the contract non-compilable. (It failed to insert after the { of if block and inserted inside the if)

Error: CompileError: /home/circleci/repo/plasma_framework/.coverage_contracts/src/transactions/eip712Libs/PaymentEip712Lib.sol:138:8: ParserError: Expected primary expression.
       else { coverage_0x2e142684(0x95339fce433c333b185bc690238a8492dbe8aa4afb211e28c4d5a379ce051e16); /* branch */ 

Here is one error instance on our CI: https://circleci.com/gh/omisego/plasma-contracts/3663
I make a branch for the failing code: https://github.com/boolafish/plasma-contracts/tree/solidity_coverage_bug_inserting_coverage_op_wrongly

I think the root cause is I copy pasted some weird symbol to the code comment and it start to fail. And I tried to fix with this commit: omgnetwork/plasma-contracts@c7ff3eb

It was able to work locally (to compile)

Version

  • version: 0.7.0-beta.2
@cgewecke cgewecke changed the title Solidity coverage inserting else branch to the wrong place and failed to compile Non-ascii chars cause compilation failure, (inserting else branch in the wrong place) Oct 3, 2019
@cgewecke
Copy link
Member

cgewecke commented Oct 3, 2019

Thanks so much @boolafish.

For future reference, we need to replace to non-ascii characters in the source files as part of pre-processing because they mess up the parser range counts somehow.

str.replace(/[^\x00-\x7F]/g, " ");

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

No branches or pull requests

2 participants