Parses error with arrays with ABIEncoderV2
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.
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
-
ItemDefinerandValidItemCheckerboth compile, butInvalidItemCheckerdoes not. -
ItemDefinerandInvalidItemCheckercan be parsed, butValidItemCheckercannot be parsed.
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.
@federicobond I would also love this to be fixed :) Has there been any progress on this? Thanks!