Skip to content

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

Closed
@braised-babbage

Description

@braised-babbage

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions