Skip to content
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

Const Values are not validated properly. #1185

Closed
doug-q opened this issue Jun 12, 2024 · 0 comments · Fixed by #1222
Closed

Const Values are not validated properly. #1185

doug-q opened this issue Jun 12, 2024 · 0 comments · Fixed by #1222
Assignees
Labels
bug Something isn't working

Comments

@doug-q
Copy link
Collaborator

doug-q commented Jun 12, 2024

guppy emits a const node:

    {
      "parent": 40,
      "input_extensions": null,
      "op": "Const",
      "v": {
        "v": "Sum",
        "tag": 1,
        "typ": {
          "t": "Sum",
          "s": "Unit",
          "size": 2
        },
        "vs": [
          {
            "v": "Tuple",
            "vs": []
          }
        ]
      }
    },

This is invalid because unit types should have an empty "vs".

hugr-cli loads and validates this without complaining.

Calling validate on a hugr should fail if values do not match the types in const nodes.
When fixing this it may be worthwhile to remove the Value::Tuple constructor which can be subsumed by Value::Sum

@ss2165 ss2165 added the bug Something isn't working label Jun 18, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 25, 2024
Fixes #1185. We add a test for #1091, but the fix unclear now, see
#1225.

---------

Co-authored-by: Douglas Wilson <douglas.wilson@quantinuum.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants