-
Notifications
You must be signed in to change notification settings - Fork 196
Open
Description
Solhint crashes with a TypeError: Cannot read properties of null (reading 'accept') when attempting to parse Solidity files. The error occurs during AST building when visiting contract parts
Steps to Reproduce
I experienced this error when I ran solhint on https://github.com/paritytech/polkadot-sdk
*Run solhint with the following command:
solhint ./**/*.sol -c solhint.json -f json --disc
The parser crashes before completing the scan
Error Output
[solhint] Warning: Rule 'custom-errors' doesn't exist
[solhint] Warning: Rule 'contract-name-camelcase' doesn't exist
[solhint] Warning: Rule 'event-name-camelcase' doesn't exist
[solhint] Warning: Rule 'named-return-values' doesn't exist
TypeError: Cannot read properties of null (reading 'accept')
at ASTBuilder.visit (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:3236:19)
at ASTBuilder.visitContractPart (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:38463:17)
at ContractPartContext.accept (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:35068:22)
at ASTBuilder.visit (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:3236:19)
at /opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:38477:58
at Array.map (<anonymous>)
at ASTBuilder.visitContractDefinition (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:38477:41)
at ContractDefinitionContext.accept (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:34951:22)
at ASTBuilder.visit (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:3236:19)
at /opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:38456:59
The error occurs in the @solidity-parser/parser dependency when building the AST. The parser encounters a null node when attempting to visit contract parts, suggesting it may be related to:
- Incomplete or malformed contract syntax
- Unsupported Solidity language features
- Edge cases in the parser's handling of certain contract structures
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels