diff --git a/guppylang/compiler/expr_compiler.py b/guppylang/compiler/expr_compiler.py index 8c8f64e0..4f2f5d7e 100644 --- a/guppylang/compiler/expr_compiler.py +++ b/guppylang/compiler/expr_compiler.py @@ -327,7 +327,8 @@ def python_value_to_hugr(v: Any, exp_ty: Type) -> val.Value | None: case list(elts): assert is_list_type(exp_ty) return list_value( - [python_value_to_hugr(elt, get_element_type(exp_ty)) for elt in elts] + [python_value_to_hugr(elt, get_element_type(exp_ty)) for elt in elts], + get_element_type(exp_ty).to_hugr(), ) case _: # Pytket conversion is an optional feature diff --git a/guppylang/prelude/_internal.py b/guppylang/prelude/_internal.py index 84804722..bc8f64f1 100644 --- a/guppylang/prelude/_internal.py +++ b/guppylang/prelude/_internal.py @@ -58,7 +58,7 @@ class ListValue(BaseModel): """Hugr representation of floats in the arithmetic extension.""" c: Literal["ListValue"] = "ListValue" - value: list[Any] + value: tuple[list[Any], tys.Type] def bool_value(b: bool) -> val.Value: @@ -76,9 +76,9 @@ def float_value(f: float) -> val.Value: return val.ExtensionVal(c=(ConstF64(value=f),)) -def list_value(v: list[val.Value]) -> val.Value: +def list_value(v: list[val.Value], ty: tys.Type) -> val.Value: """Returns the Hugr representation of a list value.""" - return val.ExtensionVal(c=(ListValue(value=v),)) + return val.ExtensionVal(c=(ListValue(value=(v, ty)),)) def logic_op(op_name: str, args: list[tys.TypeArg] | None = None) -> ops.OpType: diff --git a/validator/Cargo.lock b/validator/Cargo.lock index dc19fc87..3eaba53c 100644 --- a/validator/Cargo.lock +++ b/validator/Cargo.lock @@ -438,9 +438,9 @@ dependencies = [ [[package]] name = "quantinuum-hugr" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dff35dcdb01eaaf25378f89b0f0d0dce79dc3189307d784d4c7bebbd5effa7e" +checksum = "277a0c87e40de34c82a31077d3adbe00ee218609295bac1c9e4cde9cfa6a22d2" dependencies = [ "bitvec", "cgmath", @@ -614,15 +614,15 @@ dependencies = [ [[package]] name = "strum" -version = "0.25.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" dependencies = [ "heck", "proc-macro2", diff --git a/validator/Cargo.toml b/validator/Cargo.toml index f9471264..741430d5 100644 --- a/validator/Cargo.toml +++ b/validator/Cargo.toml @@ -10,6 +10,6 @@ crate-type = ["cdylib"] [dependencies] pyo3 = "0.19.0" -quantinuum-hugr = "0.1.0" +quantinuum-hugr = "0.2.0" lazy_static = "1.4.0" serde_json = "1.0.111"