Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Fallback functions cannot have parameters #364

Closed
leonardishere opened this issue Nov 11, 2022 · 1 comment
Closed

Error: Fallback functions cannot have parameters #364

leonardishere opened this issue Nov 11, 2022 · 1 comment

Comments

@leonardishere
Copy link

These are both legal declarations of the fallback function. Hardhat/ethers successfully compiles and executes both

fallback() external payable;
fallback(bytes calldata data) external payable returns (bytes memory result);

Using the first solhint has no issues. Using the second I get

$ solhint contracts/*
/usr/lib/node_modules/solhint/lib/index.js:40
      throw e
      ^

Error: Fallback functions cannot have parameters
    at ASTBuilder.FunctionDefinition (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:25509:17)
    at ASTBuilder.visit (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:26831:42)
    at ASTBuilder.ContractPart (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:25458:17)
    at ASTBuilder.visit (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:26831:42)
    at ASTBuilder.<anonymous> (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:26816:26)
    at Array.map (<anonymous>)
    at ASTBuilder.visit (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:26815:20)
    at ASTBuilder.ContractDefinition (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:25445:22)
    at ASTBuilder.visit (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:26831:42)
    at ASTBuilder.<anonymous> (/usr/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:26816:26)

I see some issues and PRs about changing the parser that might solve this issue. Using solidity 0.8.x and solhint 3.3.7 if that makes a difference

@dbale-altoros
Copy link
Collaborator

dbale-altoros commented Jan 16, 2023

This issue is fixed when upgrading to the last solidity parser version (0.14.5)
#378

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

No branches or pull requests

2 participants