Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b26e66e
deleted subscript tests
nicolaassolini-qntm Jun 17, 2026
41d149e
deleted npy
nicolaassolini-qntm Jun 17, 2026
e2dc5f0
Merge remote-tracking branch 'origin/main' into na/1610-delete-tests
nicolaassolini-qntm Jun 17, 2026
660635e
deleted all hugrs and repeted tests
nicolaassolini-qntm Jun 17, 2026
53f0463
new modifier examples
nicolaassolini-qntm Jun 17, 2026
a69b487
solve bug
nicolaassolini-qntm Jun 18, 2026
3269cd7
refactor
nicolaassolini-qntm Jun 18, 2026
bf47c1b
fixed 2nd bug
nicolaassolini-qntm Jun 18, 2026
5a0876a
Merge branch 'main' into na/1710-bug-with-classic-higher-order-functions
nicolaassolini-qntm Jun 18, 2026
5a2fc1f
Merge remote-tracking branch 'origin/main' into na/1610-delete-tests
nicolaassolini-qntm Jun 18, 2026
ab9f1ab
Merge remote-tracking branch 'origin/na/1710-bug-with-classic-higher-…
nicolaassolini-qntm Jun 18, 2026
ae571b3
add proper dependecy
nicolaassolini-qntm Jun 19, 2026
131737a
Merge remote-tracking branch 'origin/main' into na/1610-delete-tests
nicolaassolini-qntm Jun 19, 2026
12f2a1b
other deletes
nicolaassolini-qntm Jun 19, 2026
22df144
nice refactor
nicolaassolini-qntm Jun 19, 2026
28bfb4f
fixed test
nicolaassolini-qntm Jun 19, 2026
baec378
uploaded hugr and npy files
nicolaassolini-qntm Jun 19, 2026
8300b6b
updated file in tests
nicolaassolini-qntm Jun 19, 2026
c0bd1a3
final upgrade
nicolaassolini-qntm Jun 19, 2026
9aa9848
Merge remote-tracking branch 'origin/main' into na/1610-delete-tests
nicolaassolini-qntm Jun 19, 2026
b8a6eea
Merge remote-tracking branch 'origin/main' into na/1610-delete-tests
nicolaassolini-qntm Jun 22, 2026
0f75b37
added new test
nicolaassolini-qntm Jun 22, 2026
fd881c7
Merge remote-tracking branch 'origin/na/1610-delete-tests' into na/te…
nicolaassolini-qntm Jun 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed test_files/guppy_examples/modifiers.hugr
Binary file not shown.
31 changes: 0 additions & 31 deletions test_files/guppy_examples/modifiers.py

This file was deleted.

3 changes: 1 addition & 2 deletions test_files/guppy_examples/use_of_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from pathlib import Path
from sys import argv

from guppylang import guppy
from guppylang.experimental import enable_experimental_features
from guppylang import guppy, enable_experimental_features
from guppylang.std.builtins import control, power
from guppylang.std.quantum import angle, discard, qubit
from guppylang.std.quantum import h, rx
Expand Down
Binary file removed test_files/modifier_examples/assign_in_dagger.hugr
Binary file not shown.
43 changes: 0 additions & 43 deletions test_files/modifier_examples/assign_in_dagger.py

This file was deleted.

Binary file removed test_files/modifier_examples/call1_in_ctrl.hugr
Binary file not shown.
46 changes: 0 additions & 46 deletions test_files/modifier_examples/call1_in_ctrl.py

This file was deleted.

Binary file removed test_files/modifier_examples/call2_in_ctrl.hugr
Binary file not shown.
52 changes: 0 additions & 52 deletions test_files/modifier_examples/call2_in_ctrl.py

This file was deleted.

Binary file removed test_files/modifier_examples/call_in_dagger.hugr
Binary file not shown.
45 changes: 0 additions & 45 deletions test_files/modifier_examples/call_in_dagger.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@
# "guppylang-internals==1.0.0a5",
# ]
# ///
"""Controlling a function with internal control flow"""
"""Test control modifier on functions with internal control flow"""

from pathlib import Path
from sys import argv
import sys

from guppylang import guppy
from guppylang import enable_experimental_features, guppy
from guppylang.std.angles import angle
from guppylang.std.builtins import control
from guppylang.std.debug import state_result
from guppylang.std.quantum import discard, h, qubit, rx, x, rz
from guppylang.std.angles import angle

sys.path.append(str(Path(__file__).resolve().parents[1]))

from guppylang.experimental import enable_experimental_features
from guppylang.std.quantum import discard, h, qubit, rx, rz, x

enable_experimental_features()

Expand Down
Binary file not shown.
45 changes: 0 additions & 45 deletions test_files/modifier_examples/classical_array_op.py

This file was deleted.

Binary file not shown.
71 changes: 71 additions & 0 deletions test_files/modifier_examples/classical_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "guppylang==1.0.0a5",
# "guppylang-internals==1.0.0a5",
# ]
# ///
"""Test the use of a classical function inside modifiers"""

from pathlib import Path
from sys import argv

from guppylang import enable_experimental_features, guppy
from guppylang.std.array import array_swap
from guppylang.std.builtins import array, control, dagger
from guppylang.std.debug import state_result
from guppylang.std.quantum import angle, discard, h, measure, qubit, rx, x

enable_experimental_features()


@guppy
def fuu(i: int) -> int:
q = qubit()
x(q)
if measure(q):
i = i + 1
return i


@guppy
def main() -> None:
t = qubit()
c1 = qubit()
c2 = qubit()
arr = array(1, 1, 2, 1, 1)

# Testing that array operations are happening in the correct order
with control(t), dagger:
arr[1] += 1
arr[1] *= 2
if arr[1] == 4:
h(c1)

# Test that array swap in a dagger and control context works correctly
with dagger:
array_swap(arr, 2, 4)
with control(c2):
array_swap(arr, 0, 4)
if arr[0] == 2:
h(c2)

# Test that dagger and control does not affect the classical function
with control(c1):
d1 = fuu(2)
with dagger:
i = 2
d2 = fuu(i)
d3 = fuu(i)
with control(c2):
d = (d1 + d2 + d3) / (i + 1)
rx(t, angle(1 / d))

state_result("r", c1, c2, t)
discard(c1)
discard(c2)
discard(t)


program = main.compile()
Path(argv[0]).with_suffix(".hugr").write_bytes(program.to_bytes())
Binary file not shown.
Loading
Loading