Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 0 additions & 188 deletions QIR-README.md

This file was deleted.

7 changes: 3 additions & 4 deletions build/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ $artifacts = @{
".\src\QsCompiler\Optimizations\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QsOptimizations.dll",
".\src\QsCompiler\SyntaxProcessor\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QsSyntaxProcessor.dll",
".\src\QsCompiler\TextProcessor\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QsTextProcessor.dll",
".\src\QsCompiler\Transformations\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QsTransformations.dll"

".\src\QsCompiler\Transformations\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QsTransformations.dll",
".\src\QsCompiler\CommandLineTool\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\qsc.dll",

".\src\QuantumSdk\Tools\BuildConfiguration\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.Sdk.BuildConfiguration.dll"
".\src\QuantumSdk\Tools\BuildConfiguration\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.Sdk.BuildConfiguration.dll",
".\src\QuantumSdk\Tools\DefaultEntryPoint\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.Sdk.DefaultEntryPoint.Generation.dll"
) | ForEach-Object { Join-Path $PSScriptRoot (Join-Path ".." $_) };
}

Expand Down
1 change: 1 addition & 0 deletions build/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ $all_ok = $True

Publish-One '../src/QsCompiler/CommandLineTool/CommandLineTool.csproj'
Publish-One '../src/QuantumSdk/Tools/BuildConfiguration/BuildConfiguration.csproj'
Publish-One '../src/QuantumSdk/Tools/DefaultEntryPoint/DefaultEntryPoint.csproj'

Pack-One '../src/QsCompiler/Compiler/Compiler.csproj' '-IncludeReferencedProjects'
Pack-Dotnet '../src/Documentation/DocumentationGenerator/DocumentationGenerator.csproj'
Expand Down
12 changes: 7 additions & 5 deletions src/QsCompiler/CommandLineTool/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ public ConsoleLogger(
/// Prints the given message to the Console.
/// Errors and Warnings are printed to the error stream.
/// </summary>
private static void PrintToConsole(DiagnosticSeverity severity, string message)
private static void PrintToConsole(DiagnosticSeverity? severity, string message)
{
var (stream, color) =
severity == DiagnosticSeverity.Error ? (Console.Error, ConsoleColor.Red) :
severity == DiagnosticSeverity.Warning ? (Console.Error, ConsoleColor.Yellow) :
(Console.Out, Console.ForegroundColor);
var (stream, color) = severity switch
{
DiagnosticSeverity.Error => (Console.Error, ConsoleColor.Red),
DiagnosticSeverity.Warning => (Console.Error, ConsoleColor.Yellow),
_ => (Console.Out, Console.ForegroundColor)
};

var consoleColor = Console.ForegroundColor;
Console.ForegroundColor = color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="16.3.57" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="16.9.1180" />
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
</ItemGroup>

Expand Down
46 changes: 29 additions & 17 deletions src/QsCompiler/CompilationManager/DiagnosticTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,35 @@ public static Position SymbolPosition(QsLocation rootLocation, QsNullable<Positi
[return: NotNullIfNotNull("message")]
public static Diagnostic? Copy(this Diagnostic message)
{
Lsp.Position? CopyPosition(Lsp.Position? position) =>
position is null ? null : new Lsp.Position(position.Line, position.Character);

Lsp.Range? CopyRange(Lsp.Range? range) =>
range is null
? null
: new Lsp.Range
{
Start = CopyPosition(range.Start),
End = CopyPosition(range.End)
};
Lsp.Position CopyPosition(Lsp.Position position) =>
new Lsp.Position(position.Line, position.Character);

Lsp.Range CopyRange(Lsp.Range range) =>
new Lsp.Range
{
Start = CopyPosition(range.Start),
End = CopyPosition(range.End)
};

// NB: The nullability metadata on Diagnostic.Range is incorrect,
// such that some Diagnostic values may have nullable ranges.
// We cannot assign that to a new Diagnostic without
// contradicting nullability metadata, however, so we need to
// explicitly disable nullable references for the following
// statement. Once the upstream bug in the LSP client package
// is fixed, we can remove the nullable disable here.
#nullable disable
return message is null
? null
: new Diagnostic
{
Range = CopyRange(message.Range),
Range = message.Range == null ? null : CopyRange(message.Range),
Severity = message.Severity,
Code = message.Code,
Source = message.Source,
Message = message.Message
};
#nullable restore
}

/// <summary>
Expand All @@ -70,12 +77,17 @@ range is null
public static Diagnostic WithLineNumOffset(this Diagnostic diagnostic, int offset)
{
var copy = diagnostic.Copy();
copy.Range.Start.Line += offset;
copy.Range.End.Line += offset;
if (copy.Range.Start.Line < 0 || copy.Range.End.Line < 0)
// NB: Despite the nullability metadata, Range may be null here.
// We thus need to guard accordingly.
if (copy.Range != null)
{
throw new ArgumentOutOfRangeException(
nameof(offset), "Translated diagnostic has negative line numbers.");
copy.Range.Start.Line += offset;
copy.Range.End.Line += offset;
if (copy.Range.Start.Line < 0 || copy.Range.End.Line < 0)
{
throw new ArgumentOutOfRangeException(
nameof(offset), "Translated diagnostic has negative line numbers.");
}
}
return copy;
}
Expand Down
Loading