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

Compile-time check for missing args in private calls #1579



Copy link

iamdefinitelyahuman commented Aug 24, 2019

What I did

Added a check for calls to private functions where no args are given but the call expects args. Prior to this PR, the following code would compile:

def bar(a: int128) -> int128:
    return 1

def foo() -> int128:

I also tweaked the inputs to pack_arguments, allowing for code highlights in the exceptions raised there.

How I did it

  • vyper.parser.self_call.call_self_private
    • added a check when no args are given that raises if args were expected
  • vyper.parser.parser_utils.pack_arguments
    • replaced input arg pos with stmt_expr, derive position using getpos(stmt_expr)
    • include stmt_expr when raising exceptions

How to verify it

Run the tests. I've added tests to check for args when none should be given, no args when args should be given, and the wrong number of args.

Cute Animal Picture



This comment has been minimized.

Copy link

jacqueswww commented Aug 24, 2019


@fubuloubu fubuloubu merged commit f7e18e6 into vyperlang:master Aug 24, 2019
3 checks passed
3 checks passed
ci/circleci: lint Your tests passed on CircleCI!
ci/circleci: py36-core Your tests passed on CircleCI!
ci/circleci: py37-core Your tests passed on CircleCI!
@iamdefinitelyahuman iamdefinitelyahuman deleted the iamdefinitelyahuman:self-call-missing-args branch Aug 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.