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

Parse error with named mapping #179

Closed
chalex-eth opened this issue Jun 9, 2023 · 10 comments
Closed

Parse error with named mapping #179

chalex-eth opened this issue Jun 9, 2023 · 10 comments

Comments

@chalex-eth
Copy link

Hello,

When running some surya function such as inheritance or graph on solidity code (> 0.8.18) that implement mapping we get a parse error.

Let's say the following mapping

mapping(uint256 num1 => uint256 num2) myMapping;

Will result in

errors: [
    {
      message: "extraneous input 'num1' expecting '=>'",
      line: 61,
      column: 20
    },
    {
      message: "extraneous input 'num2' expecting ')'",
      line: 61,
      column: 45
    }
  ]
}
@GNSPS
Copy link
Collaborator

GNSPS commented Jun 14, 2023

Hey @chalex-eth can you please try to uninstall surya and install again?

npm uninstall -g surya
npm install -g surya

The reason why I suggest this is because there is a floating dependency on the parser and it might just be an old parser version.

@rashtrakoff
Copy link

can you please try to uninstall surya and install again?

This doesn't work unfortunately ☹️ . I converted the named mapping to a normal (unnamed) mapping and then it works as expected.

@vittominacori
Copy link
Contributor

Same error using OpenZeppelin v5 ERC20 implementation that uses named mapping.

message: "extraneous input 'account' expecting '=>'",

@tintinweb
Copy link
Member

ref: Consensys/vscode-solidity-auditor#137

@GNSPS might require a parser update to v0.16.x

@GNSPS
Copy link
Collaborator

GNSPS commented Oct 13, 2023

Updated! 🙏 Closing!

@GNSPS GNSPS closed this as completed Oct 13, 2023
@hexpaydaydev
Copy link

did not work for me on first install. cleaning cache currently. we'll see if that helps


surya@^0.4.6:
  version "0.4.6"
  resolved "https://registry.yarnpkg.com/surya/-/surya-0.4.6.tgz#295a426eff219720d9b7963e04a50206288c321b"
  integrity sha512-zaTYkRbms26cuOWu5jon5l4OsToHX7ZEflqTozXgq/XxUL3VY+tEnxT9Te2WVsA/sYgZPwcH92yQZJgljsss4g==
  dependencies:
    "@solidity-parser/parser" "^0.14.1"

@hexpaydaydev
Copy link

ah, was a new version not published @GNSPS ?

@hexpaydaydev
Copy link

yup. 2 years ago: https://www.npmjs.com/package/surya

new pkg needs to be published to link it to solidity metrics and beyond

@GNSPS
Copy link
Collaborator

GNSPS commented Oct 13, 2023

Yep, sorry, was waiting for a PR fix from myself for address member calls.

Published a new "patch" version: v0.4.7, can you try now? 🙏

@hexpaydaydev
Copy link

works! 🎉

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

Successfully merging a pull request may close this issue.

6 participants