qsharp-runtime icon indicating copy to clipboard operation
qsharp-runtime copied to clipboard

AllowAtMostNQubits not allowing at most N qubits

Open Strilanc opened this issue 3 years ago • 1 comments

The following test passes:

    @Test("ResourcesEstimator")
    operation test_repro() : Unit {
        within {
            AllowAtMostNQubits(0, "Workspace");
        } apply {
            use q = Qubit();
            X(q);
        }
    }

It should fail.

Project details:

<Project Sdk="Microsoft.Quantum.Sdk/0.23.195983">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Quantum.AutoSubstitution" Version="0.18.2107153439" IsQscReference="true" />
    <PackageReference Include="Microsoft.Quantum.Xunit" Version="0.16.2105140472" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
    <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
  </ItemGroup>
</Project>

Strilanc avatar Mar 17 '22 03:03 Strilanc

I've transferred this issue from qsharp-language to qsharp-runtime and marked it as bug. We should investigate to understand why enforcement is not happening here.

swernli avatar Mar 24 '22 18:03 swernli