federicobond / solidity-parser-antlr

A Solidity parser for JS built on top of a robust ANTLR4 grammar
MIT License
155 stars 55 forks source link

Parses error with arrays with ABIEncoderV2 #88

Open kerzhner opened 5 years ago

kerzhner commented 5 years ago

We are seeing a parse error with valid solidity when decoding an array of structs. If Imported.Item is a struct, the following errors:

bytes memory itemBytes;
Imported.Item[] memory items = abi.decode(itemBytes, (Imported.Item[]));

The error is ParserError: missing ';' at...

There is no error with non-array decoding (even though below is not valid solidity):

bytes memory itemBytes;
Imported.Item[] memory items = abi.decode(itemBytes, (Imported.Item));

We are using version 0.4.11 via the prettier-plugin-solidity package.

andrewgordstewart commented 5 years ago

I created a fairly minimal example of the issue here. Note that I had to modify @kerzhner's example a little.

https://gist.github.com/andrewgordstewart/6fa284c4ef02e4b7063fbbba7a5f8594

If you put the three contracts into three separate files, then

federicobond commented 5 years ago

Thanks for the report. I already fixed this in the grammar, and I am working on a fix the JS parser. It may take some time before it bubbles up to prettier-solidity though, as I had to make some backwards incompatible changes in the AST.

Alonski commented 4 years ago

@federicobond I would also love this to be fixed :) Has there been any progress on this? Thanks!