Skip to content

Validation validates Hugr with wrong op input type #2598

@tatiana-s

Description

@tatiana-s

Calling validate in Guppy (which leads to read_hugr_envelope in Selene underneath which calls package.validate()) validates a Hugr which should be invalid.

In this particular case there was a bug in the Guppy compiler where a struct was passed to an op that takes an array as input (discard_all_borrowed should only take a borrow array as input, not a tuple):

Image

So this test for example (where the above diagram snippet is from and which used the buggy code, full file attached below) passed fine (and the bug was only discovered later during execution):

 def test_hugr_gen(validate):
    @guppy
    def main() -> None:
        for x in array(1, 2, 3):
            pass

    validate(main.compile())

array_iter.txt

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions