Describe the bug
When defining a UDT with a named item whose type is a non-singleton tuple, the C# code generation step produces invalid properties that then fail to compile when running dotnet build.
To Reproduce
namespace runtime_bug {
open Microsoft.Quantum.Arrays;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
newtype GeneratorIndex = (IndexData: (Int[], Double[]), Subsystems: Int[]);
function Example() : GeneratorIndex[] {
return Mapped(
GeneratorIndex(_, [0, 1, 2]),
[
([0], [0.0]),
([1, 1], [1.1, 1.1]),
([2, 2, 2], [2.2, 2.2, 2.2])
]
);
}
function Boom() : Int {
let foos = Example();
Message($"{foos}");
return (Fst(foos[0]::IndexData))[0];
}
}
Expected behavior
Boom should return 0.
Actual behavior
obj\qsharp\src\Operations.g.cs(27,62): error CS0029: Cannot implicitly convert type 'Microsoft.Quantum.Simulation.Core.IQArray<long>' to '(Microsoft.Quantum.Simulation.Core.IQArray<long>, Microsoft.Quantum.Simulation.Core.IQArray<double>)' [C:\Users\chgranad.REDMOND\tmp\runtime-bug\runtime-bug.csproj]
obj\qsharp\src\Operations.g.cs(28,45): error CS0266: Cannot implicitly convert typ 'Microsoft.Quantum.Simulation.Core.IQArray<double>' to 'Microsoft.Quantum.Simulation.Core.IQArray<long>'. An explicit conversion exists (are you missing a cast?) [C:\Users\chgranad.REDMOND\tmp\runtime-bug\runtime-bug.csproj]
The generated code referred to by the above error:
public (IQArray<Int64>,IQArray<Double>) IndexData => Data.Item1.Item1;
public IQArray<Int64> Subsystems => Data.Item1.Item2;
public (IQArray<Int64>,IQArray<Double>) Item1 => Data.Item1;
public IQArray<Int64> Item2 => Data.Item2;
System information
<ItemGroup>
<PackageReference Include="Microsoft.Quantum.Standard" Version="0.8.1907.2504" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.8.1907.2504" />
</ItemGroup>