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

fix[ux]: catch extcalls in range expr and loop iterator #3884

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

tserg
Copy link
Collaborator

@tserg tserg commented Mar 23, 2024

What I did

Fix #3867

How I did it

Add a check for Extcall nodes in a range call and as loop iterator.

How to verify it

See tests.

Commit message

fix: catch extcalls in range expr and loop iterator

This PR improves the error message when an external call is made
in a for loop as part of a `range` expression or as the loop iterator.

Description for the changelog

Cute Animal Picture

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

@codecov-commenter
Copy link

codecov-commenter commented Mar 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.36%. Comparing base (f8d4b97) to head (2772e37).

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

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3884   +/-   ##
=======================================
  Coverage   86.36%   86.36%           
=======================================
  Files          92       92           
  Lines       14024    14026    +2     
  Branches     3081     3082    +1     
=======================================
+ Hits        12112    12114    +2     
  Misses       1484     1484           
  Partials      428      428           

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

Copy link
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.

interesting that we don't need (as much) analysis anymore. but i'm not sure this works for side effecting expressions which aren't marked with extcall (e.g. raw_call, internal calls which result in state changes, etc). i think a more robust solution is going to be to pass around a context variable with the current scope's modifiability information

@charles-cooper
Copy link
Member

this is a dup of #3546 no?

@cyberthirst
Copy link
Collaborator

interface I:
    def bar() -> DynArray[uint256, 10]: nonpayable

@external
def bar(t: address):
    for i: uint256 in extcall I(t).bar():
        pass
vyper.exceptions.CodegenPanic: unhandled exception typechecker missed this, parse_ExtCall

  contract "tests/custom/test4.vy:6", function "bar", line 6:22 
       5 def bar(t: address):
  ---> 6     for i: uint256 in extcall I(t).bar():
  -----------------------------^
       7         pass


This is an unhandled internal compiler error. Please create an issue on Github to notify the developers!
https:/vyperlang/vyper/issues/new?template=bug.md

@tserg tserg changed the title fix: catch extcalls in range expr fix: catch extcalls in range expr and loop iterator Oct 11, 2024
@tserg tserg changed the title fix: catch extcalls in range expr and loop iterator fix[ux]: catch extcalls in range expr and loop iterator Oct 11, 2024
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.

extcall in range expr is not caught until codegen
4 participants