Skip to content

constexpr DynArray subscript gets evaluated at runtime #4436

@cyberthirst

Description

@cyberthirst

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions