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

Remove type keyword from layout error report #728

Open
frangio opened this issue Jan 27, 2023 · 0 comments
Open

Remove type keyword from layout error report #728

frangio opened this issue Jan 27, 2023 · 0 comments

Comments

@frangio
Copy link
Contributor

frangio commented Jan 27, 2023

In the error report we keep the struct/contract keywords. Yet, in the retyped annotations we expect the type without those keywords. A user might copy the type from the error and put it in the retype annotation and it would not work (see also #727).

See struct V2.ProposalCore below:

Error: New storage layout is incompatible

contracts/Test.sol:36: Upgraded `_proposals` to an incompatible type
  - In mapping(uint256 => struct V2.ProposalCore)
    - Bad upgrade from struct V1.ProposalCore to struct V2.ProposalCore

I believe we should also remove the keywords from the error messages, as a result the types will look more like Solidity to the user and they will also be copy-pastable into the retyped annotation.

As a side note, the function should probably be renamed:

export function stripContractSubstrings(label?: string) {
if (label !== undefined) {
return label.replace(/\b(contract|struct|enum) /g, '');
}
}

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

1 participant