Closed Oighty closed 2 years ago
Fallback functions with the expanded syntax for inputs and output: fallback (bytes calldata input) external [payable] returns (bytes memory output) are not correctly parsed. This syntax is valid per the latest Solidity documentation.
fallback (bytes calldata input) external [payable] returns (bytes memory output)
This issue is in reference to a related bug in the prettier-solidity/prettier-plugin-solidity repo (issue 659) where fallback functions with parameters and returnParameters are not correctly formatted.
I believe the issue is that the parser doesn't capture the parameters and returnsParameters when the fallback keyword is identified in parser/ASTBuilder.ts https://github.com/solidity-parser/parser/blob/1a7bfb8752821945f894d47cbe588d1b0478541d/src/ASTBuilder.ts#L342-L345
fallback
A potential fix is using the parameter and returnParameter parsing logic implemented for the function keyword starting on line 354 of the same file:
function
parameters = ctx .parameterList() .parameter() .map((x) => this.visit(x)) returnParameters = ctxReturnParameters !== undefined ? this.visitReturnParameters(ctxReturnParameters) : null
Having the same issue would appreciate it if this can be fixed asap.
The same applies to receive functions
receive
Fallback functions with the expanded syntax for inputs and output:
fallback (bytes calldata input) external [payable] returns (bytes memory output)
are not correctly parsed. This syntax is valid per the latest Solidity documentation.This issue is in reference to a related bug in the prettier-solidity/prettier-plugin-solidity repo (issue 659) where fallback functions with parameters and returnParameters are not correctly formatted.
I believe the issue is that the parser doesn't capture the parameters and returnsParameters when the
fallback
keyword is identified in parser/ASTBuilder.ts https://github.com/solidity-parser/parser/blob/1a7bfb8752821945f894d47cbe588d1b0478541d/src/ASTBuilder.ts#L342-L345A potential fix is using the parameter and returnParameter parsing logic implemented for the
function
keyword starting on line 354 of the same file: