solidity-parser / parser

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

v0.18.0 - "TypeError: Cannot read properties of null (reading 'accept')" when parsing old-style value transfers `msg.sender.send{1 ETH}()` #116

Open tintinweb opened 7 months ago

tintinweb commented 7 months ago

Hey 👋,

was about to update https://github.com/tintinweb/solidity-workspace/ to v0.18.0 and one of my test-cases fired with an unhandled exception. Afaik the statement causing this is a - now - obsolete form of an eth value transfer. This used to throw a more meaningful error in the previous version. Please kindly let me know if this is expected behavior or if this should throw something more meaningful (expected).

Thanks!


Testcase: https://github.com/tintinweb/solidity-workspace/blob/master/examples/learnSolidity.sol#L61-L62

msg.sender.send{1 ETH}(); //this is actually illegal - note missing 'value:'
RandomContract(lol).doSomething{value: 1 ETH}();

Leads to unhandled exception:

./js/solidity-workspace/node_modules/@solidity-parser/parser/dist/index.cjs.js:3252
    }, this) : t2.accept(this);
                  ^

TypeError: Cannot read properties of null (reading 'accept')

refs: https://github.com/tintinweb/solidity-workspace/pull/4