diff --git a/src/Simulation/CsharpGeneration/Context.fs b/src/Simulation/CsharpGeneration/Context.fs index 514a7636577..c692c705e9a 100644 --- a/src/Simulation/CsharpGeneration/Context.fs +++ b/src/Simulation/CsharpGeneration/Context.fs @@ -19,7 +19,7 @@ module internal DeclarationLocations = type TransformationState() = member val internal CurrentSource = null with get, set - member val internal DeclarationLocations = new List * (int * int)>() + member val internal DeclarationLocations = new List * Position>() type NamespaceTransformation(parent : SyntaxTreeTransformation) = inherit NamespaceTransformation(parent) @@ -60,7 +60,7 @@ type CodegenContext = { allQsElements : IEnumerable allUdts : ImmutableDictionary allCallables : ImmutableDictionary - declarationPositions : ImmutableDictionary, ImmutableSortedSet> + declarationPositions : ImmutableDictionary, ImmutableSortedSet> byName : ImmutableDictionary,(NonNullable*QsCallable) list> current : QsQualifiedName option signature : ResolvedSignature option diff --git a/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj b/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj index 65b75b2e1df..75496178ba5 100644 --- a/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj +++ b/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj @@ -21,7 +21,7 @@ - + diff --git a/src/Simulation/CsharpGeneration/SimulationCode.fs b/src/Simulation/CsharpGeneration/SimulationCode.fs index 8b2b10ebfd5..3a419aac894 100644 --- a/src/Simulation/CsharpGeneration/SimulationCode.fs +++ b/src/Simulation/CsharpGeneration/SimulationCode.fs @@ -274,7 +274,7 @@ module SimulationCode = override this.OnStatement (node:QsStatement) = match node.Location with | Value loc -> - let (current, _) = loc.Offset + let current = loc.Offset.Line parent.LineNumber <- parent.StartLine |> Option.map (fun start -> start + current + 1) // The Q# compiler reports 0-based line numbers. | Null -> parent.LineNumber <- None // auto-generated statement; the line number will be set to the specialization declaration @@ -839,7 +839,7 @@ module SimulationCode = override this.OnSpecializationDeclaration (sp : QsSpecialization) = count <- 0 match sp.Location with - | Value location -> parent.StartLine <- Some (location.Offset |> fst) + | Value location -> parent.StartLine <- Some location.Offset.Line | Null -> parent.StartLine <- None // TODO: we may need to have the means to know which original declaration the code came from base.OnSpecializationDeclaration sp @@ -1003,12 +1003,12 @@ module SimulationCode = | Null -> [] | Value location -> [ // since the line numbers throughout the generated code are 1-based, let's also choose them 1-based here - let startLine = fst location.Offset + 1 + let startLine = location.Offset.Line + 1 let endLine = match context.declarationPositions.TryGetValue sp.SourceFile with | true, startPositions -> let index = startPositions.IndexOf location.Offset - if index + 1 >= startPositions.Count then -1 else fst startPositions.[index + 1] + 1 + if index + 1 >= startPositions.Count then -1 else startPositions.[index + 1].Line + 1 //TODO: diagnostics. | false, _ -> startLine ``attribute`` None (``ident`` "SourceLocation") [ @@ -1328,7 +1328,7 @@ module SimulationCode = let properties = buildOutput () let methods = match op.Location with - | Value location -> [ buildUnitTest targetName opName (fst location.Offset) op.SourceFile.Value ] + | Value location -> [ buildUnitTest targetName opName location.Offset.Line op.SourceFile.Value ] // TODO: diagnostics | Null -> failwith "missing location for unit test" diff --git a/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj b/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj index a7d91377dcd..ff3f9c59da5 100644 --- a/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj +++ b/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj b/src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj index 610567a3181..6e8467e5159 100644 --- a/src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj +++ b/src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj index cb464f8c01d..27cc28e4a65 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj @@ -1,4 +1,4 @@ - + Library @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj index 71bd465814e..8396c045f93 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj index a7745b792ef..83d11ae6541 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj @@ -1,4 +1,4 @@ - + Library @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj b/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj index 6cce3506ac6..df4d6e13a43 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 false diff --git a/src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj b/src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj index 426f60111e2..c01bc8d99bc 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 diff --git a/src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj b/src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj index 426f60111e2..c01bc8d99bc 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 diff --git a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj index 3bee22e3534..fcc18c5313d 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj @@ -1,4 +1,4 @@ - + Library @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/src/Simulation/Simulators.Tests/TestProjects/QsharpExe/QsharpExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/QsharpExe/QsharpExe.csproj index d6401020995..e74705db790 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/QsharpExe/QsharpExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/QsharpExe/QsharpExe.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj index b8f0258e5c2..6e76c47fe19 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj @@ -1,4 +1,4 @@ - + Exe @@ -37,4 +37,4 @@ - \ No newline at end of file + diff --git a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj index 7cc66e81104..03d1c8a4a8e 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj index ed018f6a6f2..ca7ce29588f 100644 --- a/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj +++ b/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj index ef8c2bb42b6..00cd0c2aeda 100644 --- a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj +++ b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj @@ -1,4 +1,4 @@ - +