From b13c9b452ff59b6e1e563accd7de2cf70abe722c Mon Sep 17 00:00:00 2001 From: Mark Koch Date: Mon, 6 Nov 2023 09:45:53 +0000 Subject: [PATCH] fix: Use panicking division ops --- guppy/prelude/integer.py | 16 +++++----------- validator/Cargo.lock | 2 +- validator/Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/guppy/prelude/integer.py b/guppy/prelude/integer.py index d3d6fd64..1ad9dda1 100644 --- a/guppy/prelude/integer.py +++ b/guppy/prelude/integer.py @@ -82,9 +82,7 @@ def __ceil__(self: int) -> int: ... -@extension.func( - OpCompiler(ops.DummyOp(name="idivmod_s_panic")), instance=IntType # TODO -) +@extension.func(OpCompiler(IntOpCompiler("idivmod_s", num_params=2)), instance=IntType) def __divmod__(self: int, other: int) -> tuple[int, int]: ... @@ -104,7 +102,7 @@ def __floor__(self: int, other: int) -> int: ... -@extension.func(OpCompiler(ops.DummyOp(name="idiv_s_panic")), instance=IntType) # TODO +@extension.func(IntOpCompiler("idiv_s", num_params=2), instance=IntType) def __floordiv__(self: int, other: int) -> int: ... @@ -146,7 +144,7 @@ def __lt__(self: int, other: int) -> bool: ... -@extension.func(OpCompiler(ops.DummyOp(name="imod_s_panic")), instance=IntType) # TODO +@extension.func(IntOpCompiler("imod_s", num_params=2), instance=IntType) def __mod__(self: int, other: int) -> int: ... @@ -191,16 +189,12 @@ def __rand__(self: int, other: int) -> int: ... -@extension.func( - Reversed(OpCompiler(ops.DummyOp(name="idivmod_s_panic"))), instance=IntType # TODO -) +@extension.func(Reversed(IntOpCompiler("idivmod_s", num_params=2)), instance=IntType) def __rdivmod__(self: int, other: int) -> int: ... -@extension.func( - Reversed(OpCompiler(ops.DummyOp(name="idiv_s_panic"))), instance=IntType # TODO -) +@extension.func(Reversed(IntOpCompiler("idiv_s", num_params=2)), instance=IntType) def __rfloordiv__(self: int, other: int) -> int: ... diff --git a/validator/Cargo.lock b/validator/Cargo.lock index a1664d87..dbbe4b7b 100644 --- a/validator/Cargo.lock +++ b/validator/Cargo.lock @@ -426,7 +426,7 @@ dependencies = [ [[package]] name = "quantinuum-hugr" version = "0.1.0" -source = "git+https://github.com/CQCL-DEV/hugr.git?rev=46d50176c3bb7589ef8349a31d6801d45c3313b9#46d50176c3bb7589ef8349a31d6801d45c3313b9" +source = "git+https://github.com/CQCL-DEV/hugr.git?rev=1a07cd9aca60aa75257bdb297d7442d9529765fb#1a07cd9aca60aa75257bdb297d7442d9529765fb" dependencies = [ "bitvec", "cgmath", diff --git a/validator/Cargo.toml b/validator/Cargo.toml index ff428e21..bebf14df 100644 --- a/validator/Cargo.toml +++ b/validator/Cargo.toml @@ -10,6 +10,6 @@ crate-type = ["cdylib"] [dependencies] pyo3 = "0.19.0" -quantinuum-hugr = { git = "https://github.com/CQCL-DEV/hugr.git", rev = "46d50176c3bb7589ef8349a31d6801d45c3313b9" } +quantinuum-hugr = { git = "https://github.com/CQCL-DEV/hugr.git", rev = "1a07cd9aca60aa75257bdb297d7442d9529765fb" } rmp-serde = "1.1.1" lazy_static = "1.4.0"