Skip to content

Commit

Permalink
fix: try int type instead of usize
Browse files Browse the repository at this point in the history
  • Loading branch information
qartik committed Feb 17, 2025
1 parent a0b97cc commit bd3c1bd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
11 changes: 10 additions & 1 deletion tket2-exts/src/tket2_exts/data/tket2/qsystem/utils.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
"input": [],
"output": [
{
"t": "I"
"t": "Opaque",
"extension": "arithmetic.int.types",
"id": "int",
"args": [
{
"tya": "BoundedNat",
"n": 6
}
],
"bound": "C"
}
],
"runtime_reqs": []
Expand Down
13 changes: 8 additions & 5 deletions tket2-hseries/src/extension/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ use derive_more::derive::Display;
use hugr::{
builder::{BuildError, Dataflow},
extension::{
prelude::{usize_t, UnwrapBuilder},
prelude::UnwrapBuilder,
simple_op::{try_from_name, MakeOpDef, MakeRegisteredOp},
ExtensionId, ExtensionRegistry, ExtensionSet, OpDef, SignatureFunc, Version, PRELUDE,
},
std_extensions::arithmetic::int_types::int_type,
type_row,
types::Signature,
Extension, Wire,
Expand Down Expand Up @@ -66,7 +67,7 @@ pub enum UtilsOp {
impl MakeOpDef for UtilsOp {
fn init_signature(&self, _extension_ref: &std::sync::Weak<Extension>) -> SignatureFunc {
match self {
UtilsOp::GetCurrentShot => Signature::new(type_row![], usize_t()),
UtilsOp::GetCurrentShot => Signature::new(type_row![], int_type(6)),
}
.into()
}
Expand Down Expand Up @@ -140,9 +141,11 @@ mod test {
#[test]
fn get_current_shot() {
let hugr = {
let mut func_builder =
FunctionBuilder::new("get_current_shot", Signature::new(vec![], vec![usize_t()]))
.unwrap();
let mut func_builder = FunctionBuilder::new(
"get_current_shot",
Signature::new(vec![], vec![int_type(6)]),
)
.unwrap();
let shot = func_builder.add_get_current_shot().unwrap();
func_builder.finish_hugr_with_outputs([shot]).unwrap()
};
Expand Down

0 comments on commit bd3c1bd

Please sign in to comment.