Skip to content

Commit

Permalink
Add hugr string val
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana-s committed Dec 19, 2024
1 parent c3435b4 commit 14c5446
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions guppylang/compiler/expr_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")

Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14c5446

Please sign in to comment.