iqsharp
iqsharp copied to clipboard
Unhelpful error message on invalid return type
Describe the bug
Unit return type is not allowed on provider submission. If this return type is used, a specific warning is given via dotnet compilation: warning QS6205: Only values of type Result, Result[], and tuples thereof can be returned when executing on a quantum processor. In IQ#, the error message given is:

To Reproduce Steps to reproduce the behavior:
- Create a new Q# notebook.
- Define an operation with return type
Unit. Example:
open Microsoft.Quantum.Measurement;
operation PrepareBellPair(left : Qubit, right : Qubit) : Unit is Adj + Ctl {
H(left);
CNOT(left, right);
}
operation Teleport(msg : Qubit, target : Qubit) : Unit {
use register = Qubit();
PrepareBellPair(register, target);
Adjoint PrepareBellPair(msg, register);
if MResetZ(msg) == One { Z(target); }
if MResetZ(register) == One { X(target); }
}
operation RunTeleport() : Unit {
use left = Qubit();
use right = Qubit();
H(left);
Teleport(left, right);
H(right);
}
- Connect to an Azure Quantum workspace and submit the job.
Expected behavior A more helpful error message, like what is provided in dotnet compilation.
System information
- OS: Windows 10
- Browser: Edge
- Version: 0.18.2107153439