Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Error while using sol-coverage: Cannot read property 'range' of null #1530

Closed
hoytech opened this issue Jan 18, 2019 · 3 comments · Fixed by #1557
Closed

Error while using sol-coverage: Cannot read property 'range' of null #1530

hoytech opened this issue Jan 18, 2019 · 3 comments · Fixed by #1557
Assignees

Comments

@hoytech
Copy link

hoytech commented Jan 18, 2019

Basically as the title says. There's some ridiculous java-esque stack trace, here is the top:

TypeError: Cannot read property 'range' of null
    at ASTVisitor._shouldIgnoreExpression (XXX-contract/node_modules/@0x/sol-tracing-utils/src/ast_visitor.ts:182:29)
    at ASTVisitor._visitStatement (XXX-contract/node_modules/@0x/sol-tracing-utils/src/ast_visitor.ts:165:18)
    at ASTVisitor.ExpressionStatement (XXX-contract/node_modules/@0x/sol-tracing-utils/src/ast_visitor.ts:92:14)

I was able to fix it by adding:

    if (ast === null) return true;

to the top of the _shouldIgnoreExpression method in ast_visitor.ts.

Not sure if I have some weird solidity or something. It's possible, but I don't think I have anything that unusual.

After that change the report was generated OK and it looks pretty cool, so thanks!

@LogvinovLeon LogvinovLeon self-assigned this Jan 20, 2019
@LogvinovLeon LogvinovLeon reopened this Jan 20, 2019
@LogvinovLeon
Copy link
Contributor

Thanks for reporting. Could you please attach the example contract where it happens? I'd like to know if it should be fixed on our side or on the AST parser side.

@hoytech
Copy link
Author

hoytech commented Jan 20, 2019

If I have some time in the future I'll try to build up a minimal test-case for this, but a bit busy at the moment.

@hoytech
Copy link
Author

hoytech commented Feb 1, 2019

Thank you for addressing all these, I'll report back if I find any issues. Cheers!

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

Successfully merging a pull request may close this issue.

2 participants