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

fix[ux]: improve initializer hint for unimported modules #4145

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Jun 13, 2024

What I did

fix #4092

How I did it

How to verify it

Commit message

improve initializer hint in the case that the needed module is not
already imported

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

improve initializer hint in the case that the needed module is not
imported
@charles-cooper charles-cooper marked this pull request as ready for review June 13, 2024 11:26
@cyberthirst
Copy link
Collaborator

can't we hint where the import should be performed?

@charles-cooper
Copy link
Member Author

can't we hint where the import should be performed?

you mean at the top of the file?

@cyberthirst
Copy link
Collaborator

can't we hint where the import should be performed?

you mean at the top of the file?

i meant into which module:

Error compiling: tests/custom/test4.vy
vyper.exceptions.InitializerException: `lib2` uses `lib1`, but it is not initialized with `lib1`

  (hint: try importing `lib1` first (located at `tests/custom/lib1.vy`))

  contract "tests/custom/lib3.vy:3", line 3:0 
       2
  ---> 3 initializes: lib2
  -------^

here we have an error for test4, initialization happens in lib3, it is said lib2 uses something.. lot of modules are mentioned - it might not be immediately obvious where to insert the import

@charles-cooper
Copy link
Member Author

charles-cooper commented Jun 13, 2024

can't we hint where the import should be performed?

you mean at the top of the file?

i meant into which module:

Error compiling: tests/custom/test4.vy
vyper.exceptions.InitializerException: `lib2` uses `lib1`, but it is not initialized with `lib1`

  (hint: try importing `lib1` first (located at `tests/custom/lib1.vy`))

  contract "tests/custom/lib3.vy:3", line 3:0 
       2
  ---> 3 initializes: lib2
  -------^

here we have an error for test4, initialization happens in lib3, it is said lib2 uses something.. lot of modules are mentioned - it might not be immediately obvious where to insert the import

from offline discussion -- might be nice to have the hint below the source traceback, probably out of scope / should be a new PR though

@charles-cooper charles-cooper merged commit e9e9d78 into vyperlang:master Jun 13, 2024
157 checks passed
@charles-cooper charles-cooper deleted the fix/initializer-hint branch June 13, 2024 15:29
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 this pull request may close these issues.

initializer hint improvement
2 participants