Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Parses error with arrays with ABIEncoderV2 #88

Open
kerzhner opened this issue Sep 10, 2019 · 3 comments
Open

Parses error with arrays with ABIEncoderV2 #88

kerzhner opened this issue Sep 10, 2019 · 3 comments

Comments

@kerzhner
Copy link

kerzhner commented Sep 10, 2019

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
Copy link

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

  • ItemDefiner and ValidItemChecker both compile, but InvalidItemChecker does not.
  • ItemDefiner and InvalidItemChecker can be parsed, but ValidItemChecker cannot be parsed.

@federicobond
Copy link
Owner

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
Copy link

Alonski commented Nov 10, 2019

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

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

No branches or pull requests

4 participants