Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Implementing an existing internal function as public leads to compilation step error #1438

Open
msoeken opened this issue May 16, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@msoeken
Copy link
Member

msoeken commented May 16, 2022

Describe the bug

The following code fails on executing the "Functor Generation" compilation step when running dotnet build once, then succeeds when running dotnet build twice. It should probably fail. The error only happens when the project that contains the code is included as project reference to another project.

To Reproduce

<!-- Library/Library.csproj -->
<Project Sdk="Microsoft.Quantum.Sdk/0.24.208024">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Quantum.Numerics" Version="0.24.208024" />
  </ItemGroup>
</Project>
// Library/Code.qs
namespace Microsoft.Quantum.Convert {
    open Microsoft.Quantum.Arrays;
    open Microsoft.Quantum.Math;

    function BoolArrayAsFixedPoint(integerBits : Int, bits : Bool[]) : Double {
        let numBits = Length(bits);
        let intPart = (Tail(bits) ? -(1 <<< (numBits - 1)) | 0) + BoolArrayAsInt(Most(bits));
        return IntAsDouble(intPart) / PowD(2.0, IntAsDouble(numBits - integerBits));
    }
}
<!-- Test/Test.csproj -->
<Project Sdk="Microsoft.Quantum.Sdk/0.24.208024">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="../Library/Library.csproj" />
    <PackageReference Include="Microsoft.Quantum.Xunit" Version="0.24.208024" />
    <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>
// Test/Test.qs
// can be empty

Call dotnet build in the Test directory.

Expected behavior

Should not fail. An internal declaration in a referenced project/package should not interfere with a public declaration in the referencing project. (see comment)

System information

  • Your operating system and .NET Core version : mac OS, .NET 6.0.202
@msoeken msoeken added bug Something isn't working needs triage An initial review by a maintainer is needed labels May 16, 2022
@bettinaheim
Copy link
Contributor

The correct behavior would be for it to work fine; An internal declaration in a referenced project/package should not interfere with a public declaration in the referencing project.

@bettinaheim bettinaheim removed the needs triage An initial review by a maintainer is needed label May 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants