solidity-parser / parser

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

Unable to parse address[][] in abidecode() #66

Closed zerosnacks closed 2 years ago

zerosnacks commented 2 years ago

Whilst the Solidity compiler compiles this without errors the parser throws (both with Solhint and Prettier) on the following line:

(IUniswapV2Router02 uniswapV2Router, address[][] memory swapPaths) = abi.decode(strategyData, (IUniswapV2Router02, address[][]));

Context: https://github.com/Rari-Capital/fuse-v1/blob/15b3920fb017b3115b07362d7578d2df65f36582/src/liquidators/BalancerPoolTokenLiquidator.sol#L63

Error (on running Solhint):

/home/zerosnacks/Projects/fuse-v1/node_modules/solhint/lib/index.js:40
      throw e
      ^

Error: Unrecognized expression
    at ASTBuilder.visitExpression (/home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:36165:11)
    at ExpressionContext.accept (/home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:34066:22)
    at ASTBuilder.visit (/home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:17669:19)
    at /home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:36301:19
    at Array.map (<anonymous>)
    at ASTBuilder.visitTupleExpression (/home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:36297:57)
    at TupleExpressionContext.accept (/home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:34972:22)
    at ASTBuilder.visit (/home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:17669:19)
    at ASTBuilder.visitPrimaryExpression (/home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:36293:17)
    at ASTBuilder.visitExpression (/home/zerosnacks/Projects/fuse-v1/node_modules/@solidity-parser/parser/dist/index.cjs.js:36018:21)
fvictorio commented 2 years ago

Thank you, I'll try to get this fixed as soon as I have some time.

fvictorio commented 2 years ago

Hey @zerosnacks, I forgot to close this issue. This is now working in v0.14.2 :slightly_smiling_face:

zerosnacks commented 2 years ago

Thanks! 😀