Skip to content

[BUG] Complex value initialization error #249

@TheGupta2012

Description

@TheGupta2012

Environment

  • PyQASM version: 0.5.0
  • Python version: 3.11.6
  • Operating system: macOS 15.6

What happened?

Can't not initialize complex value without im part -

In [54]: import pyqasm

In [55]: qasm = """
    ...: OPENQASM 3.0;
    ...: complex[float] d = 0.1;
    ...: """

In [56]: mod = pyqasm.loads(qasm)

In [57]: mod.validate()
ERROR:pyqasm: Error at line 3, column 0 in QASM file

 >>>>>> complex[float] d = 0.1;

Suggestions (Optional)

We should implicitly cast float to imaginary by setting the value as x + 0im

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions