From 429a9b28d50bdf89f16f42cb170dd2a9b1551503 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Thu, 5 Sep 2024 15:05:05 +0100 Subject: [PATCH] Fix some array op errors --- guppylang/prelude/_internal/std_ops.py | 2 +- tests/integration/modules/mod_b.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/guppylang/prelude/_internal/std_ops.py b/guppylang/prelude/_internal/std_ops.py index 588269c5..7fd0bf85 100644 --- a/guppylang/prelude/_internal/std_ops.py +++ b/guppylang/prelude/_internal/std_ops.py @@ -38,7 +38,7 @@ def new_array(length: int, elem_ty: ht.Type) -> ops.ExtOp: """Returns an operation that creates a new fixed length array.""" op_def = hugr.std.PRELUDE.get_op("new_array") sig = ht.FunctionType([elem_ty] * length, [array_type(length, elem_ty)]) - return ops.ExtOp(op_def, sig, [ht.TypeTypeArg(elem_ty)]) + return ops.ExtOp(op_def, sig, [ht.BoundedNatArg(length), ht.TypeTypeArg(elem_ty)]) @dataclass diff --git a/tests/integration/modules/mod_b.py b/tests/integration/modules/mod_b.py index 2a2e5c89..223c88c1 100644 --- a/tests/integration/modules/mod_b.py +++ b/tests/integration/modules/mod_b.py @@ -1,7 +1,7 @@ """Dummy module used in `test_imports.py`""" from guppylang import GuppyModule, guppy -from guppylang.prelude._internal.util import int_op +from guppylang.prelude._internal.util import unsupported_op mod_b = GuppyModule("mod_b") @@ -11,9 +11,8 @@ def f(x: bool) -> bool: return not x -@guppy.hugr_op(mod_b, int_op("h", "dummy", 0)) -def h() -> int: - ... +@guppy.hugr_op(mod_b, unsupported_op("h")) +def h() -> int: ... @guppy.struct(mod_b)