Skip to content

Attempt to generate controlled/adjoint variant when it is not requested #1929

@tcNickolas

Description

@tcNickolas

Describe the bug

I'm trying to pick a random gate from an array, and using DrawRandomInt as the index fails because it doesn't support controlled and thus adjoint cannot be generated.

To Reproduce

operation Test3() : Bool {
    let ind = DrawRandomInt(0, 2);
    let op = [Rx, Ry, Rz][ind](1., _);
    let op1 = [Rx, Ry, Rz][DrawRandomInt(0, 2)](1., _);
    true
}

op and op1 are initialized in the same way (except the variable ind), but the second one yields an error.

Expected behavior

Two initializations of op and op1 should behave the same, since they do the same thing.

Screenshots

image

System information

  • VS Code 1.93.0
  • QDK 1.8.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions