This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Compilation fails when specifying microsoft.simulator as ExecutionTarget and using some operations provided by libraries #1069
Copy link
Copy link
Closed
Labels
area: code gen (QIR)QIR code generationQIR code generationbugSomething isn't workingSomething isn't working
Description
When a Q# application that uses some operations like ApplyToEach, ForEach or MResetZ provided by Q# libraries, compilation fails.
To Reproduce
Steps to reproduce the behavior:
- Create a Q# application that has the following project file:
<Project Sdk="Microsoft.Quantum.Sdk/0.17.2106147493-alpha">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ExecutionTarget>microsoft.simulator</ExecutionTarget>
</PropertyGroup>
</Project>
- Implement a program that uses some library functions like ApplyToEach
,ForEachorMResetZ`.
namespace Quantum.MicrosoftSimulatoExecutionTargetBug {
open Microsoft.Quantum.Arrays;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Measurement;
@EntryPoint()
operation HelloQ () : Unit {
use qubits = Qubit[10]
{
ApplyToEachA(H, qubits);
let resuls = ForEach(MResetZ, qubits);
}
}
}
- Compile the program (
dotnet buildwas used to reproduce). Compilation fails with the following error:
> dotnet build
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
Determining projects to restore...
All projects are up-to-date for restore.
____________________________________________
Q#: Success! (0 errors, 0 warnings)
C:\Microsoft\Tests\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug\Program.qs(42,199): error CS0234: The type or namespace name '_cc8e2bb1a3764c8b88eba7d6dd43903e_ApplyToEachA' does not exist in the namespace 'Microsoft.Quantum.Canon' (are you missing an assembly reference?) [C:\Microsoft\Tests\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug.csproj]
C:\Microsoft\Tests\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug\Program.qs(44,207): error CS0234: The type or namespace name '_ae951f11a8f84c88814040aad1d98988_ForEach' does not exist in the namespace 'Microsoft.Quantum.Arrays' (are you missing an assembly reference?) [C:\Microsoft\Tests\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug.csproj]
Build FAILED.
C:\Microsoft\Tests\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug\Program.qs(42,199): error CS0234: The type or namespace name '_cc8e2bb1a3764c8b88eba7d6dd43903e_ApplyToEachA' does not exist in the namespace 'Microsoft.Quantum.Canon' (are you missing an assembly reference?) [C:\Microsoft\Tests\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug.csproj]
C:\Microsoft\Tests\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug\Program.qs(44,207): error CS0234: The type or namespace name '_ae951f11a8f84c88814040aad1d98988_ForEach' does not exist in the namespace 'Microsoft.Quantum.Arrays' (are you missing an assembly reference?) [C:\Microsoft\Tests\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug\MicrosoftSimulatoExecutionTargetBug.csproj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:09.20
Expected behavior
Compilation succeeds.
Metadata
Metadata
Assignees
Labels
area: code gen (QIR)QIR code generationQIR code generationbugSomething isn't workingSomething isn't working