-
-
Notifications
You must be signed in to change notification settings - Fork 819
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]: include imported structs in interface output #4362
base: master
Are you sure you want to change the base?
fix[ux]: include imported structs in interface output #4362
Conversation
Should the name of a struct include module name, id? |
vyper/compiler/output.py
Outdated
@@ -159,6 +161,19 @@ def build_interface_output(compiler_data: CompilerData) -> str: | |||
return out | |||
|
|||
|
|||
def _get_structs(m: ModuleT, visited: set[ModuleT] = None) -> [StructT]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use ModuleT.reachable_imports
here instead of implementing the recursion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the recursion because for building the import paths for the output - a.b.c. struct
.
vyper/compiler/output.py
Outdated
if m in visited: | ||
return [] | ||
visited.add(m) | ||
structs = list(m.interface.structs.values()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm. what if two modules have a struct with the same name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's what i was getting at with #4362 (comment), I'll prepend it.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4362 +/- ##
==========================================
- Coverage 91.86% 91.06% -0.80%
==========================================
Files 119 119
Lines 16640 16653 +13
Branches 2801 2804 +3
==========================================
- Hits 15286 15165 -121
- Misses 929 1040 +111
- Partials 425 448 +23 ☔ View full report in Codecov by Sentry. |
What I did
Included structs from imported modules in the
-f interface
output. Fix the #4298 issue.How I did it
Added a function that recursively walks imported modules and collects structs. It contains
visited
set to track which imports were already handled.How to verify it
Added test cases and previous test cases work.
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture