Conversation
Author
|
Ping — this one and #3077 have been open since 8 and 9 August with no review. The CLA check is green on both, but it is the only check that has run — the github-actions suites are at Both are Vyper parsing fixes and are independent of each other. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2192.
Root cause.
FunctionVyper.analyze_contentdecides whether a Vyper function has a body withThe intent is "an empty Vyper body is written as
pass", but the check only looks at the firststatement. Any function whose body merely starts with
passis therefore treated asunimplemented: no CFG is built and every detector sees an empty function.
_parse_statementalready handlesPassanywhere in a body(
elif isinstance(expr, Pass): pass), so the guard is only needed for the genuinely empty case.Fix. Treat the body as empty only when every statement is
Pass.Effect. On the contract from the issue,
slitherreported three findings before the change(
unimplemented-functions,unused-state,constable-states) and reports none after it.Test.
tests/unit/core/test_function_declaration.py::test_vyper_function_body_starting_with_pass,next to the existing
test_vyper_functions. It covers both directions: a body starting withpassmust be analysed, and a body consisting solely of
passmust stay empty — the latter is thecontract already asserted for
__init__()and__default__()intest_vyper_functions.Verified per CLAUDE.md ("temporarily break code to verify the test fails"): with the test added and
the fix reverted the run fails on
assert f.is_implemented; with the fix appliedtests/unit/slithir/vyper,tests/e2e/vyper_parsingand the vyper tests intests/unit/core/test_function_declaration.pyare green.