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

constexpr DynArray subscript gets evaluated at runtime #4436

Open
cyberthirst opened this issue Jan 2, 2025 · 0 comments
Open

constexpr DynArray subscript gets evaluated at runtime #4436

cyberthirst opened this issue Jan 2, 2025 · 0 comments
Labels
needs triage needs triage

Comments

@cyberthirst
Copy link
Collaborator

Version Information

  • vyper Version (output of vyper --version): 0.4.1b2+commit.f31ff46bd

  • OS: osx/linux/win

  • Python Version (output of python --version):

What's your issue about?

MAX: constant(DynArray[uint256, 10]) = [1, 2, 3]
a: constant(uint256) = MAX[3]

@external
def foo() -> uint256:
    return a

the subscript (including clamping) happens at runtime. we should promote the runtime error to a compile time error

How can it be fixed?

Fill this in if you know how to fix it.

@cyberthirst cyberthirst added the needs triage needs triage label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage needs triage
Projects
None yet
Development

No branches or pull requests

1 participant