Skip to content

feat[venom]: add basic semantic check machinery to venom#4483

Merged
charles-cooper merged 37 commits intovyperlang:masterfrom
HodanPlodky:feat/venom/basic-check
Mar 11, 2025
Merged

feat[venom]: add basic semantic check machinery to venom#4483
charles-cooper merged 37 commits intovyperlang:masterfrom
HodanPlodky:feat/venom/basic-check

Conversation

@HodanPlodky
Copy link
Copy Markdown
Collaborator

@HodanPlodky HodanPlodky commented Feb 21, 2025

What I did

How I did it

How to verify it

Commit message

add methods for checking well-formedness for venom programs, including:
- basic blocks are terminated
- variables are defined before uses

these are implicit preconditions for various passes, but checking for
these cases explicitly can help with debugging, since the checks can be
enforced earlier (instead of waiting for the pass to panic with a fairly
enigmatic error message)

misc/refactor:
- adds an analysis to detect the defined variables at any point in the
  program.
- adds basic `VenomError` machinery

Description for the changelog

Cute Animal Picture

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

@HodanPlodky HodanPlodky changed the title Feat/venom/basic check feat[venom]: basic check Feb 21, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 91.20879% with 8 lines in your changes missing coverage. Please review.

Project coverage is 92.04%. Comparing base (ebf124f) to head (8584fae).
Report is 92 commits behind head on master.

Files with missing lines Patch % Lines
vyper/venom/check_venom.py 89.47% 6 Missing ⚠️
vyper/cli/venom_main.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4483      +/-   ##
==========================================
- Coverage   92.04%   92.04%   -0.01%     
==========================================
  Files         120      122       +2     
  Lines       17362    17453      +91     
  Branches     2941     2960      +19     
==========================================
+ Hits        15981    16064      +83     
- Misses        964      972       +8     
  Partials      417      417              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@charles-cooper charles-cooper marked this pull request as ready for review March 8, 2025 12:35
Copy link
Copy Markdown
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

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

lgtm. thanks!

@charles-cooper charles-cooper changed the title feat[venom]: basic check feat[venom]: add basic semantic check machinery to venom Mar 8, 2025
assert [err.inst.parent.label.name for err in errors] == ["after"]


def test_venom_parser_nonexistant_var_loop_incorrect_phi():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

docstring / test description please!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it might be helpful to point out the difference between this test and the previous test, which only differ in one line

assert [err.inst.parent.label.name for err in errors] == ["join", "join"]


def test_venom_parser_nonexistant_var_loop():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

docstring / test description please!

@charles-cooper charles-cooper enabled auto-merge (squash) March 11, 2025 13:08
@charles-cooper charles-cooper disabled auto-merge March 11, 2025 13:15
@charles-cooper charles-cooper enabled auto-merge (squash) March 11, 2025 13:27
@charles-cooper charles-cooper merged commit 6f5a179 into vyperlang:master Mar 11, 2025
158 of 159 checks passed
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.

3 participants