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

feat: add support for constants in imported modules #3726

Merged
merged 9 commits into from
Jan 13, 2024

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Jan 12, 2024

What I did

allow importing constants from modules

How I did it

add a case to ConstantFolder, and move the constant folder slightly down in the pipeline to after imports have been resolved.

How to verify it

see tests

Commit message

feat: add support for constants in imported modules

- add a case to ConstantFolder, and move the constant folder slightly
  down in the pipeline to after imports have been resolved.
- rename `pre_typecheck` to `constant_fold` (since that is all it does,
  and it doesn't strictly happen before typechecking anymore).

Description for the changelog

Cute Animal Picture

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

@charles-cooper charles-cooper marked this pull request as ready for review January 12, 2024 21:07
Copy link
Collaborator

@pcaversaccio pcaversaccio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we additionally fuzz the input types for the constant values in tests? The unit tests & the overall PR lgtm (besides the open errors) but this would be a great case IMO to parametrise the (allowed) types for a fuzz test.

@charles-cooper
Copy link
Member Author

Can we additionally fuzz the input types for the constant values in tests? The unit tests & the overall PR lgtm (besides the open errors) but this would be a great case IMO to parametrise the (allowed) types for a fuzz test.

added a test for arrays -- 251de24

@charles-cooper charles-cooper requested review from fubuloubu and removed request for fubuloubu January 13, 2024 13:58
@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5c2177b) 84.16% compared to head (251de24) 84.21%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3726      +/-   ##
==========================================
+ Coverage   84.16%   84.21%   +0.05%     
==========================================
  Files          92       92              
  Lines       13119    13137      +18     
  Branches     2925     2928       +3     
==========================================
+ Hits        11041    11063      +22     
+ Misses       1659     1655       -4     
  Partials      419      419              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@charles-cooper
Copy link
Member Author

the docs failure is unrelated; fixed here: #3728

@charles-cooper charles-cooper changed the title feat: implement module constants feat: add support for constants in imported modules Jan 13, 2024
@charles-cooper charles-cooper merged commit 3f013ec into vyperlang:master Jan 13, 2024
83 of 84 checks passed
@charles-cooper charles-cooper deleted the feat/module_constants branch January 13, 2024 16:48
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.

4 participants