You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@staticmethod
def _get_const_len(inst: Inst) -> ast.expr:
"""Helper function to extract the static length from the inferred type args."""
# TODO: This will stop working once we allow generic function defs. Then, the
# argument could also just be variable instead of a concrete number.
match inst:
case [_, ConstArg(const=ConstValue(value=int(n)))]:
return ast.Constant(value=n)
> raise InternalGuppyError(f"array.__len__: Invalid instantiation: {inst}")
E guppylang.error.InternalGuppyError: array.__len__: Invalid instantiation: [TypeArg(ty=OpaqueType(args=[], defn=OpaqueTypeDef(id=DefId(id=3, module=None), name='bool', defined_at=None, description='type', params=[], never_copyable=False, never_droppable=False, to_hugr=<function <lambda> at 0x106ccae80>, bound=None))), ConstArg(const=BoundConstVar(ty=NumericType(kind=<Kind.Nat: 1>), display_name='n', idx=0))]
using range(n) instead works, but I believe this is a regression.
The text was updated successfully, but these errors were encountered:
example:
throws
using
range(n)
instead works, but I believe this is a regression.The text was updated successfully, but these errors were encountered: