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

Openpulse AST definitions shadow OpenQASM AST definitions with incompatible types #35

Closed
braised-babbage opened this issue Sep 9, 2024 · 0 comments · Fixed by #34
Closed

Comments

@braised-babbage
Copy link
Collaborator

The following program fails to typecheck with mypy 1.27:

from openpulse.ast import CalibrationDefinition, CalibrationStatement

def foo(stmt: CalibrationDefinition):
    stmt.body = []

The mypy error is

mypy example.py
example.py:4: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "str")  [assignment]
Found 1 error in 1 file (checked 1 source file)

The variable has type "str" comes from the openqasm3.ast.CalibrationDefinition, which does use str for the body field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant