Skip to content

[BUG] Allow empty if blocks #246

@Sola85

Description

@Sola85

Environment

  • qBraid-QIR version: 0.4.0
  • Python version: 3.11.5
  • Operating system: Linux c5ce507e9ef3 6.6.87.2-microsoft-standard-WSL2

What happened?

Is there a reason why

OPENQASM 3.0;
include "stdgates.inc";
bit[1] c;
qubit[1] q;

if (c[0]) {
  z q[0];
} else {
  
}

gets accepted but

OPENQASM 3.0;
include "stdgates.inc";
bit[1] c;
qubit[1] q;

if (c[0]) {

} else {
  z q[0];
}

doesn't? The latter raises a pyqasm.exceptions.ValidationError: Missing if block.

Suggestions (Optional)

I think this should be accepted (as it would be in e.g. C)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions