-
Notifications
You must be signed in to change notification settings - Fork 173
Better targeting-related error messages for multi-project Q# applications #736
Description
Is your feature request related to a problem? Please describe.
When building a Q# application for Azure Quantum with multiple local projects, targeting-related error messages point to the source code in the executable project. This is not very informative, as the actual error may be in a referenced local library project, and the error doesn't tell me specifically what I'm doing that is unsupported.
For example, if I have a library project with the following code:
namespace AzureTestLibrary {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Arrays;
open Microsoft.Quantum.Convert;
open Microsoft.Quantum.Measurement;
operation MeasureEqualSuperposition() : Result[] {
using (qubits = Qubit[3])
{
ApplyToEach(H, qubits);
let results = ResultArrayAsBoolArray(MultiM(qubits));
return BoolArrayAsResultArray(results);
}
}
}
and an executable project targeting ionq.simulator, referencing the above project, with the following code:
namespace AzureTestExecutable {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
@EntryPoint()
operation GenerateRandomNumber() : Result[] {
return AzureTestLibrary.MeasureEqualSuperposition();
}
}
then I get the following compilation error:
C:\QDK\Test\AzureTestExecutable\Program.qs(7,16): error QS5027: The callable MeasureEqualSuperposition requires runtime capabilities that are not supported by the target IonQProcessor. [C:\QDK\Test\AzureTestExecutable\AzureTestExecutable.csproj]
Describe the solution you'd like
It would be much better if these error messages pointed to the source code in the local library that actually needs to be changed. For example, I'd hope to get something like:
C:\QDK\Test\AzureTestLibrary\Library.qs(12,27): error QS5027: The callable ResultArrayAsBoolArray requires runtime capabilities that are not supported by the target IonQProcessor. [C:\QDK\Test\AzureTestLibrary\AzureTestLibrary.csproj]
Describe alternatives you've considered
The only alternative I am aware of would be to put all of the code in a single executable project. But for code-sharing purposes, this is not a practical solution.
Additional context
This is also necessary in order to merge microsoft/iqsharp#362, which will improve the experience for Azure Quantum users in Python and Jupyter. IQ# uses a similar project structure as described above - the user code is compiled into one or more library assemblies, and then a targeted executable references those library assemblies.