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

Improve contract update error printing positions #3574

Closed
SupunS opened this issue Sep 4, 2024 · 0 comments · Fixed by #3582
Closed

Improve contract update error printing positions #3574

SupunS opened this issue Sep 4, 2024 · 0 comments · Fixed by #3582
Assignees
Labels
Bug Something isn't working Feedback

Comments

@SupunS
Copy link
Member

SupunS commented Sep 4, 2024

Current Behavior

During the contract update validation, errors can be reported for the old program in two occasions:

  • When parsing the old program
  • When validating the new program against the old one

The first case (parser errors) now uses the correct (old) code for pretty-printing after the fix: #3554.

However, it is still possible to report errors using the old positions during validation (2nd case above). For e.g:

  • Getting root declaration reports the error using the old declaration's position
  • Validating the type-removal pragma, also uses old code's position info for reporting errors

Given the update validator doesn't fail on the first error, having errors with position info from both old and new codes is problematic, because the pretty-printer can only use one of the two versions of code (either the new or the old code) at a given time, and will point to incorrect positions during pretty-printing the errors.

Expected Behavior

Error reporting probably need to use new code's position info, always.

Steps To Reproduce

N/A

Environment

- Cadence version: master
- Network:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Feedback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant