diff --git a/guppylang/compiler/expr_compiler.py b/guppylang/compiler/expr_compiler.py index e724cdec..a28cec4c 100644 --- a/guppylang/compiler/expr_compiler.py +++ b/guppylang/compiler/expr_compiler.py @@ -9,6 +9,7 @@ import hugr.std.float import hugr.std.int import hugr.std.logic +import hugr.std.prelude from hugr import Hugr, Wire, ops from hugr import tys as ht from hugr import val as hv @@ -596,6 +597,8 @@ def python_value_to_hugr(v: Any, exp_ty: Type) -> hv.Value | None: match v: case bool(): return hv.bool_value(v) + case str(): + return hugr.std.prelude.StringVal(v) case int(): return hugr.std.int.IntVal(v, width=NumericType.INT_WIDTH) case float(): diff --git a/pyproject.toml b/pyproject.toml index 29ceb926..fa75021e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,7 +83,7 @@ members = ["execute_llvm"] execute-llvm = { workspace = true } # Uncomment these to test the latest dependency version during development - hugr = { git = "https://github.com/CQCL/hugr", subdirectory = "hugr-py", rev = "e40b6c7" } +hugr = { git = "https://github.com/CQCL/hugr", subdirectory = "hugr-py", branch = "main" } # tket2-exts = { git = "https://github.com/CQCL/tket2", subdirectory = "tket2-exts", rev = "eb7cc63"} # tket2 = { git = "https://github.com/CQCL/tket2", subdirectory = "tket2-py", rev = "eb7cc63"} diff --git a/tests/integration/test_strings.py b/tests/integration/test_strings.py index 7b7aa411..b584bc52 100644 --- a/tests/integration/test_strings.py +++ b/tests/integration/test_strings.py @@ -12,7 +12,6 @@ def foo(x: str) -> str: validate(foo) -@pytest.mark.skip("Unsupported, see https://github.com/CQCL/hugr/issues/1817") def test_basic_value(validate): @compile_guppy def foo() -> str: @@ -22,7 +21,6 @@ def foo() -> str: validate(foo) -@pytest.mark.skip("Unsupported, see https://github.com/CQCL/hugr/issues/1817") def test_struct(validate): module = GuppyModule("module") diff --git a/uv.lock b/uv.lock index c61fbdd1..a9001a70 100644 --- a/uv.lock +++ b/uv.lock @@ -614,7 +614,7 @@ test = [ [package.metadata] requires-dist = [ { name = "graphviz", specifier = ">=0.20.1,<0.21" }, - { name = "hugr", git = "https://github.com/CQCL/hugr?subdirectory=hugr-py&rev=e40b6c7" }, + { name = "hugr", git = "https://github.com/CQCL/hugr?subdirectory=hugr-py&branch=main" }, { name = "networkx", specifier = ">=3.2.1,<4" }, { name = "pydantic", specifier = ">=2.7.0b1,<3" }, { name = "pytket", marker = "extra == 'pytket'", specifier = ">=1.34" }, @@ -678,8 +678,8 @@ test = [ [[package]] name = "hugr" -version = "0.10.0" -source = { git = "https://github.com/CQCL/hugr?subdirectory=hugr-py&rev=e40b6c7#e40b6c7057a15ead78bb18aa837e5b84e12a3722" } +version = "0.10.1" +source = { git = "https://github.com/CQCL/hugr?subdirectory=hugr-py&branch=main#b05a419e08dfcccf10fa081a22fc83af0d11502b" } dependencies = [ { name = "graphviz" }, { name = "pydantic" },