-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Allow linear data inside lists #531
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #531 +/- ##
==========================================
- Coverage 91.63% 91.57% -0.06%
==========================================
Files 59 59
Lines 6190 6161 -29
==========================================
- Hits 5672 5642 -30
- Misses 518 519 +1 ☔ View full report in Codecov by Sentry. |
^ | ||
GuppyTypeError: Expected argument of type `?T -> ?T`, got `qubit @owned -> qubit` | ||
^^^^^^ | ||
GuppyTypeError: Cannot instantiate non-linear type variable `T` in type `forall T. (T -> T) -> None` with linear type `qubit` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A side effect of the unification change is that we get a better error message here.
However, I think #487 still applies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, few queries on the unsupporteds
guppylang/prelude/builtins.py
Outdated
|
||
@guppy.hugr_op(unsupported_op("Length")) | ||
def __len__(self: list[T]) -> int: ... | ||
@guppy.hugr_op(unsupported_op("pop")) # TODO: check None and unwrap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"pop" doesn't seem right here?
|
||
@guppy.hugr_op(unsupported_op("Pop")) | ||
def __next__(self: list[T]) -> tuple[T, list[T]]: ... | ||
@guppy.hugr_op(unsupported_op("length")) # TODO: inout return in wrong order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this ordering being resolved elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually turns out that the length op doesn't return the list at all! CQCL/hugr#1543
guppylang/prelude/builtins.py
Outdated
|
||
@guppy.custom(checker=FailingChecker("Guppy lists are immutable")) | ||
def remove(self: list[T], elt: T) -> None: ... | ||
@guppy.hugr_op(unsupported_op("Pop")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case difference between "pop" and "Pop" ?
Closes #530 and closes #524.
@owned
flags if one of the arguments is not linear (otherwise we couldn't unifyL @owned
with any classical type). We'll need to revisit that once we have flags that can be put on classical types.BREAKING CHANGE: Unsupported list methods have been removed.