Skip to content

in keyword inference failure needs better error messages #40

@ausbin

Description

@ausbin

The following code:

from qwerty import *

def example(shots=1024):
    @qpu
    def kernel():
        return ('p' * '1000'
                | ('1???'>>-'1???' in '1'*'_'**4)
                | measure * discard**4)

    return kernel(shots=shots)

histogram(example())

throws the following exception when run:

 python bug.py
Traceback (most recent call last):
  File "[snip]/bug.py", line 12, in <module>
    histogram(example())
              ~~~~~~~^^
  File "[snip]/bug.py", line 10, in example
    return kernel(shots=shots)
  File "[snip]/bug.py", line 5, in example
    def kernel():
qwerty.err.QwertyExpandError: Cannot infer the following dimension variables: __0 (at column 5)

Even if #39 is fixed, this error message should be more readable. In fact, errors involving internal dimvars should never reach the user. Even an error message saying that they need to add type annotations somewhere would be better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions