From edd0c51dc1095b4782edde5e5084de0ea66ca21c Mon Sep 17 00:00:00 2001 From: Sarah Marshall Date: Wed, 6 Jan 2021 16:19:35 -0800 Subject: [PATCH 1/7] Fix outstanding StyleCop warnings --- .../DocumentationGeneration.cs | 3 +- .../DocumentationWriter.cs | 68 +++++++------------ .../ProcessDocComments.cs | 53 ++++++--------- .../DocumentationParser/DocComment.cs | 4 +- .../CommandLineTool/Commands/Build.cs | 12 ++-- .../CommandLineTool/Commands/Format.cs | 10 +-- src/QsCompiler/CommandLineTool/Logging.cs | 4 +- src/QsCompiler/CommandLineTool/Options.cs | 46 ++++++------- src/QsCompiler/CommandLineTool/Program.cs | 48 ++++++------- .../AbstractRewriteStepsLoader.cs | 1 - .../AssemblyRewriteStepsLoader.cs | 2 +- src/QsCompiler/LanguageServer/Program.cs | 10 +-- .../Tests.Compiler/CommandLineTests.fs | 26 +++---- .../Transformations/BasicTransformations.cs | 14 ++-- .../Transformations/ClassicallyControlled.cs | 12 +--- .../Transformations/FunctorGeneration.cs | 2 +- .../Transformations/Monomorphization.cs | 12 +--- 17 files changed, 139 insertions(+), 188 deletions(-) diff --git a/src/Documentation/DocumentationGenerator/DocumentationGeneration.cs b/src/Documentation/DocumentationGenerator/DocumentationGeneration.cs index 3f6a434651..c73d0010de 100644 --- a/src/Documentation/DocumentationGenerator/DocumentationGeneration.cs +++ b/src/Documentation/DocumentationGenerator/DocumentationGeneration.cs @@ -75,8 +75,7 @@ public bool Transformation(QsCompilation compilation, out QsCompilation transfor : null, this.AssemblyConstants.TryGetValue("DocsPackageId", out var packageName) ? packageName - : null - ); + : null); docProcessor.OnDiagnostic += diagnostic => { diff --git a/src/Documentation/DocumentationGenerator/DocumentationWriter.cs b/src/Documentation/DocumentationGenerator/DocumentationWriter.cs index f4aa166621..cc0d112a62 100644 --- a/src/Documentation/DocumentationGenerator/DocumentationWriter.cs +++ b/src/Documentation/DocumentationGenerator/DocumentationWriter.cs @@ -13,7 +13,6 @@ namespace Microsoft.Quantum.Documentation { - /// /// Writes API documentation files as Markdown to a given output /// directory, using parsed API documentation comments. @@ -80,9 +79,7 @@ await this.TryWithExceptionsAsDiagnostics( $"writing output to {filename}", async () => await File.WriteAllTextAsync( Path.Join(this.OutputPath, filename.ToLowerInvariant()), - contents - ) - ); + contents)); } /// @@ -117,10 +114,11 @@ public DocumentationWriter(string outputPath, string? packageName) }); if (!Directory.Exists(outputPath)) { - this.TryWithExceptionsAsDiagnostics( - "creating directory", - async () => Directory.CreateDirectory(outputPath) - ).Wait(); + this + .TryWithExceptionsAsDiagnostics( + "creating directory", + async () => Directory.CreateDirectory(outputPath)) + .Wait(); } } @@ -169,15 +167,11 @@ public async Task WriteOutput(QsNamespace ns, DocComment docComment) .MaybeWithSection( "See Also", string.Join("\n", docComment.SeeAlso.Select( - seeAlso => AsSeeAlsoLink(seeAlso) - )) - ) + seeAlso => AsSeeAlsoLink(seeAlso)))) .WithYamlHeader(header); // Open a file to write the new doc to. - await this.WriteAllTextAsync( - $"{name}.md", document - ); + await this.WriteAllTextAsync($"{name}.md", document); } /// @@ -236,25 +230,20 @@ public async Task WriteOutput(QsCustomType type, DocComment docComment) ? comment : string.Empty; return $"### {itemName} : {resolvedType.ToMarkdownLink()}\n\n{documentation}"; - } - )) - ) + }))) .MaybeWithSection("Description", docComment.Description) .MaybeWithSection("Remarks", docComment.Remarks) .MaybeWithSection("References", docComment.References) .MaybeWithSection( "See Also", string.Join("\n", docComment.SeeAlso.Select( - seeAlso => AsSeeAlsoLink(seeAlso, type.FullName.Namespace) - )) - ) + seeAlso => AsSeeAlsoLink(seeAlso, type.FullName.Namespace)))) .WithYamlHeader(header); // Open a file to write the new doc to. await this.WriteAllTextAsync( $"{type.FullName.Namespace}.{type.FullName.Name}.md", - document - ); + document); } /// @@ -294,6 +283,13 @@ public async Task WriteOutput(QsCallable callable, DocComment docComment) ["qsharp.name"] = callable.FullName.Name, ["qsharp.summary"] = docComment.Summary, }; + var keyword = callable.Kind.Tag switch + { + QsCallableKind.Tags.Function => "function ", + QsCallableKind.Tags.Operation => "operation ", + QsCallableKind.Tags.TypeConstructor => "newtype ", + _ => "" + }; var document = $@" # {title} @@ -303,15 +299,7 @@ public async Task WriteOutput(QsCallable callable, DocComment docComment) {docComment.Summary} ```{this.LanguageMode} -{ - callable.Kind.Tag switch - { - QsCallableKind.Tags.Function => "function ", - QsCallableKind.Tags.Operation => "operation ", - QsCallableKind.Tags.TypeConstructor => "newtype ", - _ => "" - } -}{callable.ToSyntax()} +{keyword}{callable.ToSyntax()} ``` " .MaybeWithSection("Description", docComment.Description) @@ -325,9 +313,7 @@ public async Task WriteOutput(QsCallable callable, DocComment docComment) ? inputComment : string.Empty; return $"### {inputName} : {resolvedType.ToMarkdownLink()}\n\n{documentation}\n\n"; - } - )) - ) + }))) .WithSection($"Output : {callable.Signature.ReturnType.ToMarkdownLink()}", docComment.Output) .MaybeWithSection( "Type Parameters", @@ -337,26 +323,20 @@ typeParam is QsLocalSymbol.ValidName name ? $@"### '{name.Item}{"\n\n"}{( docComment.TypeParameters.TryGetValue($"'{name.Item}", out var comment) ? comment - : string.Empty - )}" - : string.Empty - )) - ) + : string.Empty)}" + : string.Empty))) .MaybeWithSection("Remarks", docComment.Remarks) .MaybeWithSection("References", docComment.References) .MaybeWithSection( "See Also", string.Join("\n", docComment.SeeAlso.Select( - seeAlso => AsSeeAlsoLink(seeAlso, callable.FullName.Namespace) - )) - ) + seeAlso => AsSeeAlsoLink(seeAlso, callable.FullName.Namespace)))) .WithYamlHeader(header); // Open a file to write the new doc to. await this.WriteAllTextAsync( $"{callable.FullName.Namespace}.{callable.FullName.Name}.md", - document - ); + document); } } } diff --git a/src/Documentation/DocumentationGenerator/ProcessDocComments.cs b/src/Documentation/DocumentationGenerator/ProcessDocComments.cs index 5e4476f77d..2a676c2d39 100644 --- a/src/Documentation/DocumentationGenerator/ProcessDocComments.cs +++ b/src/Documentation/DocumentationGenerator/ProcessDocComments.cs @@ -3,22 +3,14 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; -using System.IO; using System.Linq; -using System.Threading.Tasks; using Microsoft.Quantum.QsCompiler; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.Documentation; -using Microsoft.Quantum.QsCompiler.SyntaxTokens; using Microsoft.Quantum.QsCompiler.SyntaxTree; using Microsoft.Quantum.QsCompiler.Transformations.Core; -using Newtonsoft.Json.Linq; using Range = Microsoft.Quantum.QsCompiler.DataTypes.Range; -#nullable enable - namespace Microsoft.Quantum.Documentation { /// @@ -30,7 +22,8 @@ public class ProcessDocComments : SyntaxTreeTransformation { public class TransformationState - { } + { + } /// /// An event that is raised on diagnostics about documentation @@ -53,8 +46,7 @@ public class TransformationState /// public ProcessDocComments( string? outputPath = null, - string? packageName = null - ) + string? packageName = null) : base(new TransformationState(), TransformationOptions.Disabled) { this.Writer = outputPath == null @@ -78,7 +70,9 @@ private class NamespaceTransformation internal NamespaceTransformation(ProcessDocComments parent, DocumentationWriter? writer) : base(parent) - { this.writer = writer; } + { + this.writer = writer; + } private void ValidateNames( string symbolName, @@ -86,8 +80,7 @@ private void ValidateNames( Func isNameValid, IEnumerable actualNames, Range? range = null, - string? source = null - ) + string? source = null) { foreach (var name in actualNames) { @@ -101,8 +94,7 @@ private void ValidateNames( Range = range, Source = source, Stage = IRewriteStep.Stage.Transformation, - } - ); + }); } } } @@ -114,9 +106,8 @@ public override QsNamespace OnNamespace(QsNamespace ns) { // Concatenate everything into one documentation comment. var comment = new DocComment( - ns.Documentation.SelectMany(group => group).SelectMany(comments => comments) - ); - writer?.WriteOutput(ns, comment)?.Wait(); + ns.Documentation.SelectMany(group => group).SelectMany(comments => comments)); + this.writer?.WriteOutput(ns, comment)?.Wait(); } return ns; @@ -135,10 +126,10 @@ public override QsCustomType OnTypeDeclaration(QsCustomType type) var isDeprecated = type.IsDeprecated(out var replacement); var docComment = new DocComment( - type.Documentation, type.FullName.Name, + type.Documentation, + type.FullName.Name, deprecated: isDeprecated, - replacement: replacement - ); + replacement: replacement); // Validate named item names. var inputDeclarations = type.TypeItems.ToDictionaryOfDeclarations(); @@ -148,8 +139,7 @@ public override QsCustomType OnTypeDeclaration(QsCustomType type) name => inputDeclarations.ContainsKey(name), docComment.Input.Keys, range: null, // TODO: provide more exact locations once supported by DocParser. - source: type.SourceFile - ); + source: type.SourceFile); this.writer?.WriteOutput(type, docComment)?.Wait(); @@ -178,10 +168,10 @@ public override QsCallable OnCallableDeclaration(QsCallable callable) var isDeprecated = callable.IsDeprecated(out var replacement); var docComment = new DocComment( - callable.Documentation, callable.FullName.Name, + callable.Documentation, + callable.FullName.Name, deprecated: isDeprecated, - replacement: replacement - ); + replacement: replacement); var callableName = $"{callable.FullName.Namespace}.{callable.FullName.Name}"; @@ -193,20 +183,17 @@ public override QsCallable OnCallableDeclaration(QsCallable callable) name => inputDeclarations.ContainsKey(name), docComment.Input.Keys, range: null, // TODO: provide more exact locations once supported by DocParser. - source: callable.SourceFile - ); + source: callable.SourceFile); this.ValidateNames( callableName, "type parameter", name => callable.Signature.TypeParameters.Any( typeParam => typeParam is QsLocalSymbol.ValidName validName && - validName.Item == name.TrimStart('\'') - ), + validName.Item == name.TrimStart('\'')), docComment.TypeParameters.Keys, range: null, // TODO: provide more exact locations once supported by DocParser. - source: callable.SourceFile - ); + source: callable.SourceFile); this.writer?.WriteOutput(callable, docComment)?.Wait(); diff --git a/src/Documentation/DocumentationParser/DocComment.cs b/src/Documentation/DocumentationParser/DocComment.cs index cb7c442d63..862d12955f 100644 --- a/src/Documentation/DocumentationParser/DocComment.cs +++ b/src/Documentation/DocumentationParser/DocComment.cs @@ -4,7 +4,6 @@ #nullable enable using System; -using System.Linq; using System.Collections.Generic; using System.Collections.Immutable; using System.IO; @@ -92,8 +91,7 @@ public class DocComment [Obsolete("Please use Examples instead.")] public string Example => string.Join( "\n\n", - this.Examples - ); + this.Examples); /// /// A list of examples of using the item. diff --git a/src/QsCompiler/CommandLineTool/Commands/Build.cs b/src/QsCompiler/CommandLineTool/Commands/Build.cs index 2686222502..7b567c1124 100644 --- a/src/QsCompiler/CommandLineTool/Commands/Build.cs +++ b/src/QsCompiler/CommandLineTool/Commands/Build.cs @@ -45,7 +45,7 @@ public static IEnumerable UsageExamples [Option( "response-files", Required = true, - SetName = RESPONSE_FILES, + SetName = Options.ResponseFiles, HelpText = "Response file(s) providing command arguments. Required only if no other arguments are specified. Non-default values for options specified via command line take precedence.")] public IEnumerable ResponseFiles { get; set; } @@ -53,7 +53,7 @@ public static IEnumerable UsageExamples 'o', "output", Required = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Destination folder where the output of the compilation will be generated.")] public string OutputFolder { get; set; } @@ -62,7 +62,7 @@ public static IEnumerable UsageExamples [Option( "proj", Required = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Name of the project (needs to be usable as file name).")] public string? ProjectName { get; set; } @@ -70,14 +70,14 @@ public static IEnumerable UsageExamples "emit-dll", Required = false, Default = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Specifies whether the compiler should emit a .NET Core dll containing the compiled Q# code.")] public bool EmitDll { get; set; } [Option( "perf", Required = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Destination folder where the output of the performance assessment will be generated.")] public string? PerfFolder { get; set; } @@ -204,7 +204,7 @@ public static int Run(BuildOptions options, ConsoleLogger logger) if (!BuildOptions.IncorporateResponseFiles(options, out var incorporated)) { logger.Log(ErrorCode.InvalidCommandLineArgsInResponseFiles, Array.Empty()); - return ReturnCode.INVALID_ARGUMENTS; + return ReturnCode.InvalidArguments; } options = incorporated; diff --git a/src/QsCompiler/CommandLineTool/Commands/Format.cs b/src/QsCompiler/CommandLineTool/Commands/Format.cs index 771132ab23..7d4f79e491 100644 --- a/src/QsCompiler/CommandLineTool/Commands/Format.cs +++ b/src/QsCompiler/CommandLineTool/Commands/Format.cs @@ -45,7 +45,7 @@ public static IEnumerable UsageExamples 'o', "output", Required = true, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Destination folder where the formatted files will be generated.")] public string OutputFolder { get; set; } #nullable restore annotations @@ -157,14 +157,14 @@ ImmutableDictionary LoadSources(SourceFileLoader loadFromDisk) => // no rewrite steps, no generation var loaded = new CompilationLoader(LoadSources, options.References ?? Enumerable.Empty(), logger: logger); - if (ReturnCode.Status(loaded) == ReturnCode.UNRESOLVED_FILES) + if (ReturnCode.Status(loaded) == ReturnCode.UnresolvedFiles) { - return ReturnCode.UNRESOLVED_FILES; // ignore compilation errors + return ReturnCode.UnresolvedFiles; // ignore compilation errors } else if (loaded.VerifiedCompilation is null) { logger.Log(ErrorCode.QsGenerationFailed, Enumerable.Empty()); - return ReturnCode.CODE_GENERATION_ERRORS; + return ReturnCode.CodeGenerationErrors; } // TODO: a lot of the formatting logic defined here and also in the routines above @@ -183,7 +183,7 @@ ImmutableDictionary LoadSources(SourceFileLoader loadFromDisk) => } logger.Verbosity = verbosity; } - return success ? ReturnCode.SUCCESS : ReturnCode.CODE_GENERATION_ERRORS; + return success ? ReturnCode.Success : ReturnCode.CodeGenerationErrors; } } } diff --git a/src/QsCompiler/CommandLineTool/Logging.cs b/src/QsCompiler/CommandLineTool/Logging.cs index 1efd361a47..38f6070b99 100644 --- a/src/QsCompiler/CommandLineTool/Logging.cs +++ b/src/QsCompiler/CommandLineTool/Logging.cs @@ -65,7 +65,7 @@ private static void PrintToConsole(DiagnosticSeverity severity, string message) /// Prints a summary containing the currently counted number of errors, warnings and exceptions. /// Indicates a compilation failure if the given status does not correspond to the ReturnCode indicating a success. /// - public virtual void ReportSummary(int status = CommandLineCompiler.ReturnCode.SUCCESS) + public virtual void ReportSummary(int status = CommandLineCompiler.ReturnCode.Success) { string ItemString(int nr, string name) => $"{nr} {name}{(nr == 1 ? "" : "s")}"; var errors = ItemString(this.NrErrorsLogged, "error"); @@ -75,7 +75,7 @@ public virtual void ReportSummary(int status = CommandLineCompiler.ReturnCode.SU : ""; Console.WriteLine("\n____________________________________________\n"); - if (status == CommandLineCompiler.ReturnCode.SUCCESS) + if (status == CommandLineCompiler.ReturnCode.Success) { Console.WriteLine($"Q#: Success! ({errors}, {warnings}) {exceptions}\n"); return; diff --git a/src/QsCompiler/CommandLineTool/Options.cs b/src/QsCompiler/CommandLineTool/Options.cs index 19958f257a..225c335213 100644 --- a/src/QsCompiler/CommandLineTool/Options.cs +++ b/src/QsCompiler/CommandLineTool/Options.cs @@ -32,21 +32,21 @@ public class CompilationOptions : Options "trim", Required = false, Default = DefaultOptions.TrimLevel, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "[Experimental feature] Integer indicating how much to simplify the syntax tree by eliminating selective abstractions.")] public int TrimLevel { get; set; } [Option( "load", Required = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Path to the .NET Core dll(s) defining additional transformations to include in the compilation process.")] public IEnumerable? Plugins { get; set; } [Option( "target-specific-decompositions", Required = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "[Experimental feature] Path to the .NET Core dll(s) containing target specific implementations.")] public IEnumerable? TargetSpecificDecompositions { get; set; } @@ -54,21 +54,21 @@ public class CompilationOptions : Options "load-test-names", Required = false, Default = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Specifies whether public types and callables declared in referenced assemblies are exposed via their test name defined by the corresponding attribute.")] public bool ExposeReferencesViaTestNames { get; set; } [Option( "assembly-properties", Required = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Additional properties to populate the AssemblyConstants dictionary with. Each item is expected to be of the form \"key:value\".")] public IEnumerable? AdditionalAssemblyProperties { get; set; } [Option( "runtime", Required = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Specifies the classical capabilites of the runtime. Determines what QIR profile to compile to.")] public AssemblyConstants.RuntimeCapabilities RuntimeCapabilites { get; set; } @@ -78,7 +78,7 @@ public class CompilationOptions : Options "build-exe", Required = false, Default = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Specifies whether to build a Q# command line application.")] public bool MakeExecutable { get; set; } @@ -111,9 +111,9 @@ public enum LogFormat } // Note: items in one set are mutually exclusive with items from other sets - protected const string CODE_MODE = "codeMode"; - protected const string SNIPPET_MODE = "snippetMode"; - protected const string RESPONSE_FILES = "responseFiles"; + protected const string CodeMode = "codeMode"; + protected const string SnippetMode = "snippetMode"; + protected const string ResponseFiles = "responseFiles"; [Option( 'v', @@ -134,7 +134,7 @@ public enum LogFormat 'i', "input", Required = true, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Q# code or name of the Q# file to compile.")] public IEnumerable? Input { get; set; } @@ -142,7 +142,7 @@ public enum LogFormat 's', "snippet", Required = true, - SetName = SNIPPET_MODE, + SetName = SnippetMode, HelpText = "Q# snippet to compile - i.e. Q# code occuring within an operation or function declaration.")] public string? CodeSnippet { get; set; } @@ -151,7 +151,7 @@ public enum LogFormat "within-function", Required = false, Default = false, - SetName = SNIPPET_MODE, + SetName = SnippetMode, HelpText = "Specifies whether a given Q# snipped occurs within a function")] public bool WithinFunction { get; set; } @@ -174,7 +174,7 @@ public enum LogFormat [Option( "package-load-fallback-folders", Required = false, - SetName = CODE_MODE, + SetName = CodeMode, HelpText = "Specifies the directories the compiler will search when a compiler dependency could not be found.")] public IEnumerable? PackageLoadFallbackFolders { get; set; } @@ -253,29 +253,29 @@ public ConsoleLogger GetLogger(DiagnosticSeverity defaultVerbosity = DiagnosticS /// /// text document identifier used to identify the code snippet in diagnostic mode /// - private static readonly Uri SNIPPET_FILE_URI = new Uri(Path.GetFullPath("__CODE_SNIPPET__.qs")); + private static readonly Uri SnippetFileUri = new Uri(Path.GetFullPath("__CODE_SNIPPET__.qs")); - private static string SNIPPET_FILE_ID => + private static string SnippetFileId => QsCompilerError.RaiseOnFailure( - () => CompilationUnitManager.GetFileId(SNIPPET_FILE_URI), + () => CompilationUnitManager.GetFileId(SnippetFileUri), "invalid code snippet id"); /// /// name of the namespace within which code snippets are compiled /// - private const string SNIPPET_NAMESPACE = "CODE_SNIPPET_NS"; + private const string SnippetNamespace = "CODE_SNIPPET_NS"; /// /// name of the callable within which code snippets are compiled /// - private const string SNIPPET_CALLABLE = "CODE_SNIPPET_CALLABLE"; + private const string SnippetCallable = "CODE_SNIPPET_CALLABLE"; /// /// wraps the given content into a namespace and callable that maps Unit to Unit /// public static string AsSnippet(string content, bool inFunction = false) => - $"{Declarations.Namespace} {SNIPPET_NAMESPACE} {{ \n " + - $"{(inFunction ? Declarations.Function : Declarations.Operation)} {SNIPPET_CALLABLE} () : {Types.Unit} {{ \n" + + $"{Declarations.Namespace} {SnippetNamespace} {{ \n " + + $"{(inFunction ? Declarations.Function : Declarations.Operation)} {SnippetCallable} () : {Types.Unit} {{ \n" + $"{content} \n" + // no indentation such that position info is accurate $"}} \n" + $"}}"; @@ -283,7 +283,7 @@ public static string AsSnippet(string content, bool inFunction = false) => /// /// Helper function that returns true if the given file id is consistent with the one for a code snippet. /// - public static bool IsCodeSnippet(string fileId) => fileId == SNIPPET_FILE_ID; + public static bool IsCodeSnippet(string fileId) => fileId == SnippetFileId; /// /// Returns a function that given a routine for loading files from disk, @@ -301,7 +301,7 @@ internal CompilationLoader.SourceLoader LoadSourcesOrSnippet(ILogger logger) => } else if (this.CodeSnippet != null && !input.Any()) { - return new Dictionary { { SNIPPET_FILE_URI, AsSnippet(this.CodeSnippet, this.WithinFunction) } }.ToImmutableDictionary(); + return new Dictionary { { SnippetFileUri, AsSnippet(this.CodeSnippet, this.WithinFunction) } }.ToImmutableDictionary(); } if (!input.Any()) diff --git a/src/QsCompiler/CommandLineTool/Program.cs b/src/QsCompiler/CommandLineTool/Program.cs index 3fdb6da21f..73e08e1adc 100644 --- a/src/QsCompiler/CommandLineTool/Program.cs +++ b/src/QsCompiler/CommandLineTool/Program.cs @@ -14,74 +14,74 @@ public static class ReturnCode /// /// Return code indicating that the invoked command to the Q# command line compiler succeeded. /// - public const int SUCCESS = 0; + public const int Success = 0; /// /// Return code indicating that the command to the Q# command line compiler was invoked with invalid arguments. /// - public const int INVALID_ARGUMENTS = -1; + public const int InvalidArguments = -1; /// /// Return code indicating that some of the files given to the Q# command line compiler could not be loaded. /// - public const int UNRESOLVED_FILES = -2; + public const int UnresolvedFiles = -2; /// /// Return code indicating that the compilation using the Q# command line compiler failed due to in build errors. /// - public const int COMPILATION_ERRORS = -3; + public const int CompilationErrors = -3; /// /// Return code indicating that generating the necessary functor support for the built compilation failed. /// - public const int FUNCTOR_GENERATION_ERRORS = -4; + public const int FunctorGenerationErrors = -4; /// /// Return code indicating that pre-evaluating the built compilation if possible failed. /// - public const int PREEVALUATION_ERRORS = -5; + public const int PreevaluationErrors = -5; /// /// Return code indicating that generating a binary file with the content of the built compilation failed. /// - public const int BINARY_GENERATION_ERRORS = -6; + public const int BinaryGenerationErrors = -6; /// /// Return code indicating that generating a dll containing the compiled binary failed. /// - public const int DLL_GENERATION_ERRORS = -7; + public const int DllGenerationErrors = -7; /// /// Return code indicating that generating formatted Q# code based on the built compilation failed. /// - public const int CODE_GENERATION_ERRORS = -8; + public const int CodeGenerationErrors = -8; /// /// Return code indicating that generating documentation for the built compilation failed. /// - public const int DOC_GENERATION_ERRORS = -9; + public const int DocGenerationErrors = -9; /// /// Return code indicating that invoking the specified compiler plugin(s) failed. /// - public const int PLUGIN_EXECUTION_ERRORS = -10; + public const int PluginExecutionErrors = -10; /// /// Return code indicating that an unexpected exception was thrown when executing the invoked command to the Q# command line compiler. /// - public const int UNEXPECTED_ERROR = -1000; + public const int UnexpectedError = -1000; public static int Status(CompilationLoader loaded) => - loaded.SourceFileLoading == CompilationLoader.Status.Failed ? UNRESOLVED_FILES : - loaded.ReferenceLoading == CompilationLoader.Status.Failed ? UNRESOLVED_FILES : - loaded.Validation == CompilationLoader.Status.Failed ? COMPILATION_ERRORS : - loaded.FunctorSupport == CompilationLoader.Status.Failed ? FUNCTOR_GENERATION_ERRORS : - loaded.PreEvaluation == CompilationLoader.Status.Failed ? PREEVALUATION_ERRORS : - loaded.Documentation == CompilationLoader.Status.Failed ? DOC_GENERATION_ERRORS : - loaded.BinaryFormat == CompilationLoader.Status.Failed ? BINARY_GENERATION_ERRORS : - loaded.DllGeneration == CompilationLoader.Status.Failed ? DLL_GENERATION_ERRORS : - loaded.AllLoadedRewriteSteps == CompilationLoader.Status.Failed ? PLUGIN_EXECUTION_ERRORS : - loaded.Success ? SUCCESS : UNEXPECTED_ERROR; + loaded.SourceFileLoading == CompilationLoader.Status.Failed ? UnresolvedFiles : + loaded.ReferenceLoading == CompilationLoader.Status.Failed ? UnresolvedFiles : + loaded.Validation == CompilationLoader.Status.Failed ? CompilationErrors : + loaded.FunctorSupport == CompilationLoader.Status.Failed ? FunctorGenerationErrors : + loaded.PreEvaluation == CompilationLoader.Status.Failed ? PreevaluationErrors : + loaded.Documentation == CompilationLoader.Status.Failed ? DocGenerationErrors : + loaded.BinaryFormat == CompilationLoader.Status.Failed ? BinaryGenerationErrors : + loaded.DllGeneration == CompilationLoader.Status.Failed ? DllGenerationErrors : + loaded.AllLoadedRewriteSteps == CompilationLoader.Status.Failed ? PluginExecutionErrors : + loaded.Success ? Success : UnexpectedError; } public static class Program @@ -103,7 +103,7 @@ private static int Run(Func compile, T options) where logger.Verbosity = DiagnosticSeverity.Hint; logger.Log(ErrorCode.UnexpectedCommandLineCompilerException, Enumerable.Empty()); logger.Log(ex); - return ReturnCode.UNEXPECTED_ERROR; + return ReturnCode.UnexpectedError; } } @@ -114,6 +114,6 @@ public static int Main(string[] args) => (BuildCompilation.BuildOptions opts) => Run((c, o) => BuildCompilation.Run(c, o), opts), (DiagnoseCompilation.DiagnoseOptions opts) => Run((c, o) => DiagnoseCompilation.Run(c, o), opts), (FormatCompilation.FormatOptions opts) => Run((c, o) => FormatCompilation.Run(c, o), opts), - errs => ReturnCode.INVALID_ARGUMENTS); + errs => ReturnCode.InvalidArguments); } } diff --git a/src/QsCompiler/Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs index a3f0cb2936..898561a421 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs @@ -57,6 +57,5 @@ protected AbstractRewriteStepsLoader(Action? onDiagnostic = null, Ac return null; } - } } diff --git a/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs index c95ddcea7a..39e331a5a1 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs @@ -16,7 +16,7 @@ namespace Microsoft.Quantum.QsCompiler { /// /// Loads all DLLs passed into the configuration as containing external rewrite steps. - /// Disocvers and instantiates all types implementing IRewriteStep + /// Discovers and instantiates all types implementing IRewriteStep /// internal class AssemblyRewriteStepsLoader : AbstractRewriteStepsLoader { diff --git a/src/QsCompiler/LanguageServer/Program.cs b/src/QsCompiler/LanguageServer/Program.cs index a389d29e6f..23c7a73df2 100644 --- a/src/QsCompiler/LanguageServer/Program.cs +++ b/src/QsCompiler/LanguageServer/Program.cs @@ -18,8 +18,8 @@ public class Server public class Options { // Note: items in one set are mutually exclusive with items from other sets - protected const string CONNECTION_VIA_SOCKET = "connectionViaSocket"; - protected const string CONNECTION_VIA_PIPE = "connectionViaPipe"; + protected const string ConnectionViaSocket = "connectionViaSocket"; + protected const string ConnectionViaPipe = "connectionViaPipe"; [Option( 'l', @@ -33,7 +33,7 @@ public class Options 'p', "port", Required = true, - SetName = CONNECTION_VIA_SOCKET, + SetName = ConnectionViaSocket, HelpText = "Port to use for TCP/IP connections.")] public int Port { get; set; } @@ -41,7 +41,7 @@ public class Options 'w', "writer", Required = true, - SetName = CONNECTION_VIA_PIPE, + SetName = ConnectionViaPipe, HelpText = "Named pipe to write to.")] public string? WriterPipeName { get; set; } @@ -49,7 +49,7 @@ public class Options 'r', "reader", Required = true, - SetName = CONNECTION_VIA_PIPE, + SetName = ConnectionViaPipe, HelpText = "Named pipe to read from.")] public string? ReaderPipeName { get; set; } } diff --git a/src/QsCompiler/Tests.Compiler/CommandLineTests.fs b/src/QsCompiler/Tests.Compiler/CommandLineTests.fs index f4bd9a34c6..efc2771851 100644 --- a/src/QsCompiler/Tests.Compiler/CommandLineTests.fs +++ b/src/QsCompiler/Tests.Compiler/CommandLineTests.fs @@ -29,11 +29,11 @@ let private testSnippet expected args = [] let ``valid snippet`` () = - [| "-s"; "let a = 0;"; "-v n" |] |> testSnippet ReturnCode.SUCCESS + [| "-s"; "let a = 0;"; "-v n" |] |> testSnippet ReturnCode.Success [] let ``invalid snippet`` () = - [| "-s"; "let a = " |] |> testSnippet ReturnCode.COMPILATION_ERRORS + [| "-s"; "let a = " |] |> testSnippet ReturnCode.CompilationErrors [] @@ -44,7 +44,7 @@ let ``one valid file`` () = "--verbosity" "Diagnostic" |] - |> testInput ReturnCode.SUCCESS + |> testInput ReturnCode.Success [] let ``multiple valid file`` () = @@ -53,13 +53,13 @@ let ``multiple valid file`` () = ("TestCases", "General.qs") |> Path.Combine ("TestCases", "LinkingTests", "Core.qs") |> Path.Combine |] - |> testInput ReturnCode.SUCCESS + |> testInput ReturnCode.Success [] let ``one invalid file`` () = [| "-i"; ("TestCases", "TypeChecking.qs") |> Path.Combine |] - |> testInput ReturnCode.COMPILATION_ERRORS + |> testInput ReturnCode.CompilationErrors [] @@ -69,39 +69,39 @@ let ``mixed files`` () = ("TestCases", "LinkingTests", "Core.qs") |> Path.Combine ("TestCases", "TypeChecking.qs") |> Path.Combine |] - |> testInput ReturnCode.COMPILATION_ERRORS + |> testInput ReturnCode.CompilationErrors [] let ``missing file`` () = - [| "-i"; ("TestCases", "NonExistent.qs") |> Path.Combine |] |> testInput ReturnCode.UNRESOLVED_FILES + [| "-i"; ("TestCases", "NonExistent.qs") |> Path.Combine |] |> testInput ReturnCode.UnresolvedFiles [| "-i" ("TestCases", "LinkingTests", "Core.qs") |> Path.Combine ("TestCases", "NonExistent.qs") |> Path.Combine |] - |> testInput ReturnCode.UNRESOLVED_FILES + |> testInput ReturnCode.UnresolvedFiles [] let ``invalid argument`` () = [| "-i"; ("TestCases", "General.qs") |> Path.Combine; "--foo" |] - |> testInput ReturnCode.INVALID_ARGUMENTS + |> testInput ReturnCode.InvalidArguments [] let ``missing verb`` () = let args = [| "-i"; ("TestCases", "General.qs") |> Path.Combine |] let result = Program.Main args - Assert.Equal(ReturnCode.INVALID_ARGUMENTS, result) + Assert.Equal(ReturnCode.InvalidArguments, result) [] let ``invalid verb`` () = let args = [| "foo"; "-i"; ("TestCases", "General.qs") |> Path.Combine |] let result = Program.Main args - Assert.Equal(ReturnCode.INVALID_ARGUMENTS, result) + Assert.Equal(ReturnCode.InvalidArguments, result) [] @@ -117,7 +117,7 @@ let ``diagnose outputs`` () = |] let result = Program.Main args - Assert.Equal(ReturnCode.INVALID_ARGUMENTS, result) + Assert.Equal(ReturnCode.InvalidArguments, result) [] @@ -138,7 +138,7 @@ let ``options from response files`` () = |] let result = Program.Main commandLineArgs - Assert.Equal(ReturnCode.SUCCESS, result) + Assert.Equal(ReturnCode.Success, result) [] diff --git a/src/QsCompiler/Transformations/BasicTransformations.cs b/src/QsCompiler/Transformations/BasicTransformations.cs index 2f913336f2..8eb7e4200d 100644 --- a/src/QsCompiler/Transformations/BasicTransformations.cs +++ b/src/QsCompiler/Transformations/BasicTransformations.cs @@ -223,7 +223,7 @@ public SelectByFoldingOverExpressions(Func condition, Fun public class StatementTransformation : Core.StatementTransformation where TSelector : SelectByFoldingOverExpressions { - protected TSelector? SubSelector; + protected TSelector? subSelector; protected readonly Func CreateSelector; /// @@ -237,12 +237,12 @@ public StatementTransformation(Func createSelect /// public override QsStatement OnStatement(QsStatement stm) { - this.SubSelector = this.CreateSelector(this.SharedState); - var loc = this.SubSelector.Statements.OnLocation(stm.Location); - var stmKind = this.SubSelector.StatementKinds.OnStatementKind(stm.Statement); - var varDecl = this.SubSelector.Statements.OnLocalDeclarations(stm.SymbolDeclarations); + this.subSelector = this.CreateSelector(this.SharedState); + var loc = this.subSelector.Statements.OnLocation(stm.Location); + var stmKind = this.subSelector.StatementKinds.OnStatementKind(stm.Statement); + var varDecl = this.subSelector.Statements.OnLocalDeclarations(stm.SymbolDeclarations); this.SharedState.FoldResult = this.SharedState.ConstructFold( - this.SharedState.FoldResult, this.SubSelector.SharedState.FoldResult); + this.SharedState.FoldResult, this.subSelector.SharedState.FoldResult); return new QsStatement(stmKind, varDecl, loc, stm.Comments); } @@ -255,7 +255,7 @@ public override QsScope OnScope(QsScope scope) // StatementKind.Transform sets a new Subselector that walks all expressions contained in statement, // and sets its satisfiesCondition to true if one of them satisfies the condition given on initialization var transformed = this.OnStatement(statement); - if (this.SubSelector?.SharedState.SatisfiesCondition ?? false) + if (this.subSelector?.SharedState.SatisfiesCondition ?? false) { statements.Add(transformed); } diff --git a/src/QsCompiler/Transformations/ClassicallyControlled.cs b/src/QsCompiler/Transformations/ClassicallyControlled.cs index 4550a04ea6..9e59912f17 100644 --- a/src/QsCompiler/Transformations/ClassicallyControlled.cs +++ b/src/QsCompiler/Transformations/ClassicallyControlled.cs @@ -63,7 +63,7 @@ public StatementTransformation(SyntaxTreeTransformation parent) : base(parent) { } - #region Condition Reshaping Logic + // Condition Reshaping Logic /// /// Converts if-elif-else structures to nested if-else structures. @@ -227,8 +227,6 @@ private QsStatement ReshapeConditional(QsStatement statement) return statement; } - #endregion - public override QsScope OnScope(QsScope scope) { var parentSymbols = this.OnLocalDeclarations(scope.KnownSymbols); @@ -366,7 +364,7 @@ private TypedExpression CreateValueTupleExpression(params TypedExpression[] expr new InferredExpressionInformation(false, expressions.Any(exp => exp.InferredInformation.HasLocalQuantumDependency)), QsNullable.Null); - #region Condition Converting Logic + // Condition Converting Logic /// /// Creates an operation call from the conditional control API, given information @@ -644,9 +642,7 @@ private QsStatement ConvertConditionalToControlCall(QsStatement statement) } } - #endregion - - #region Condition Checking Logic + // Condition Checking Logic /// /// Checks if the statement is a condition statement that only has one conditional block in it (default blocks are optional). @@ -761,8 +757,6 @@ private bool IsConditionedOnResultInequalityExpression( return false; } - #endregion - public override QsScope OnScope(QsScope scope) { var parentSymbols = this.OnLocalDeclarations(scope.KnownSymbols); diff --git a/src/QsCompiler/Transformations/FunctorGeneration.cs b/src/QsCompiler/Transformations/FunctorGeneration.cs index cb95ad4bac..4ca5e0c33c 100644 --- a/src/QsCompiler/Transformations/FunctorGeneration.cs +++ b/src/QsCompiler/Transformations/FunctorGeneration.cs @@ -305,7 +305,7 @@ public override QsScope OnScope(QsScope scope) foreach (var statement in scope.Statements) { var transformed = this.OnStatement(statement); - if (this.SubSelector?.SharedState.SatisfiesCondition ?? false) + if (this.subSelector?.SharedState.SatisfiesCondition ?? false) { topStatements.Add(statement); } diff --git a/src/QsCompiler/Transformations/Monomorphization.cs b/src/QsCompiler/Transformations/Monomorphization.cs index 662086395e..e719643f1e 100644 --- a/src/QsCompiler/Transformations/Monomorphization.cs +++ b/src/QsCompiler/Transformations/Monomorphization.cs @@ -92,7 +92,7 @@ public static QsCompilation Apply(QsCompilation compilation) return ResolveGenerics.Apply(compilation, final, intrinsicCallableSet); } - #region ResolveGenerics + // Resolve Generics private class ResolveGenerics : SyntaxTreeTransformation { @@ -158,9 +158,7 @@ public override QsNamespace OnNamespace(QsNamespace ns) } } - #endregion - - #region RewriteImplementations + // Rewrite Implementations private static AccessModifier GetAccessModifier(ImmutableDictionary userDefinedTypes, QsQualifiedName typeName) { @@ -314,9 +312,7 @@ public override ResolvedTypeKind OnUserDefinedType(UserDefinedType udt) } } - #endregion - - #region RewriteCalls + // Rewrite Calls private static Identifier GetConcreteIdentifier( Dictionary concreteNames, @@ -465,7 +461,5 @@ public override ResolvedTypeKind OnTypeParameter(QsTypeParameter tp) } } } - - #endregion } } From 32a8f3cf1bdb30f919dd0f5f0ed8f73a6a9f1521 Mon Sep 17 00:00:00 2001 From: Sarah Marshall Date: Wed, 6 Jan 2021 16:48:11 -0800 Subject: [PATCH 2/7] Update documentation rules --- .editorconfig | 5 ----- src/Common/DelaySign.cs | 2 +- src/Common/SigningConstants.cs | 2 +- src/Common/stylecop.json | 6 +++++- src/Documentation/DocumentationParser/DocBuilder.cs | 2 +- src/Documentation/DocumentationParser/DocCallable.cs | 2 +- src/Documentation/DocumentationParser/DocItem.cs | 2 +- src/Documentation/DocumentationParser/DocNamespace.cs | 2 +- src/Documentation/DocumentationParser/DocUdt.cs | 2 +- .../DocumentationParser/Properties/AssemblyInfo.cs | 5 +++-- src/Documentation/DocumentationParser/Utils.cs | 2 +- src/Documentation/Tests.DocGenerator/DocParsingTests.cs | 2 +- src/Documentation/Tests.DocGenerator/DocWritingTests.cs | 2 +- src/Documentation/Tests.DocGenerator/Utils.cs | 2 +- src/QsCompiler/CommandLineTool/Commands/Build.cs | 3 +-- src/QsCompiler/CommandLineTool/Commands/Diagnose.cs | 2 +- src/QsCompiler/CommandLineTool/Commands/Format.cs | 3 +-- src/QsCompiler/CommandLineTool/CompilationTracker.cs | 2 +- src/QsCompiler/CommandLineTool/LoadContext.cs | 2 +- src/QsCompiler/CommandLineTool/Logging.cs | 2 +- src/QsCompiler/CommandLineTool/Options.cs | 3 +-- src/QsCompiler/CommandLineTool/Program.cs | 2 +- src/QsCompiler/CompilationManager/AssemblyLoader.cs | 2 +- src/QsCompiler/CompilationManager/CompilationUnitManager.cs | 4 +--- src/QsCompiler/CompilationManager/ContextBuilder.cs | 2 +- src/QsCompiler/CompilationManager/DataStructures.cs | 2 +- src/QsCompiler/CompilationManager/DiagnosticTools.cs | 2 +- src/QsCompiler/CompilationManager/Diagnostics.cs | 2 +- .../CompilationManager/EditorSupport/CodeActions.cs | 3 +-- .../CompilationManager/EditorSupport/CodeCompletion.cs | 2 +- .../CompilationManager/EditorSupport/EditorCommands.cs | 2 +- .../CompilationManager/EditorSupport/SymbolInformation.cs | 3 +-- src/QsCompiler/CompilationManager/FileContentException.cs | 5 ++++- src/QsCompiler/CompilationManager/FileContentManager.cs | 3 +-- src/QsCompiler/CompilationManager/PerformanceTracking.cs | 4 +--- src/QsCompiler/CompilationManager/ProcessingQueue.cs | 2 +- src/QsCompiler/CompilationManager/ProjectManager.cs | 2 +- .../CompilationManager/Properties/AssemblyInfo.cs | 2 +- src/QsCompiler/CompilationManager/ScopeTracking.cs | 3 +-- src/QsCompiler/CompilationManager/TextProcessor.cs | 2 +- src/QsCompiler/CompilationManager/TypeChecking.cs | 2 +- src/QsCompiler/CompilationManager/Utils.cs | 2 +- src/QsCompiler/Compiler/FunctorGeneration.cs | 2 +- src/QsCompiler/Compiler/LoadedStep.cs | 2 +- src/QsCompiler/Compiler/Logging.cs | 2 +- src/QsCompiler/Compiler/MetadataGeneration.cs | 2 +- src/QsCompiler/Compiler/PluginInterface.cs | 2 +- src/QsCompiler/Compiler/Process.cs | 2 +- src/QsCompiler/Compiler/Properties/AssemblyInfo.cs | 2 +- .../Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs | 3 +-- .../Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs | 2 +- src/QsCompiler/Compiler/RewriteSteps/CapabilityInference.cs | 5 ++++- .../Compiler/RewriteSteps/ClassicallyControlled.cs | 3 +-- src/QsCompiler/Compiler/RewriteSteps/ConjugationInlining.cs | 2 +- .../Compiler/RewriteSteps/ExternalRewriteStepsManager.cs | 2 +- src/QsCompiler/Compiler/RewriteSteps/FullPreEvaluation.cs | 2 +- src/QsCompiler/Compiler/RewriteSteps/FunctorGeneration.cs | 2 +- .../Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs | 2 +- src/QsCompiler/Compiler/RewriteSteps/IntrinsicResolution.cs | 2 +- src/QsCompiler/Compiler/RewriteSteps/Monomorphization.cs | 2 +- .../Compiler/RewriteSteps/TypeRewriteStepsLoader.cs | 2 +- src/QsCompiler/LanguageServer/Communication.cs | 2 +- src/QsCompiler/LanguageServer/EditorState.cs | 2 +- src/QsCompiler/LanguageServer/EventQueues.cs | 2 +- src/QsCompiler/LanguageServer/FileSystemWatcher.cs | 2 +- src/QsCompiler/LanguageServer/LanguageServer.cs | 2 +- src/QsCompiler/LanguageServer/Program.cs | 2 +- src/QsCompiler/LanguageServer/ProjectLoader.cs | 2 +- src/QsCompiler/LanguageServer/Properties/AssemblyInfo.cs | 2 +- src/QsCompiler/LanguageServer/SynchronizationContext.cs | 2 +- src/QsCompiler/LanguageServer/Utils.cs | 2 +- src/QsCompiler/TestTargets/Simulation/Target/Program.cs | 2 +- src/QsCompiler/Tests.LanguageServer/ProjectLoaderTests.cs | 2 +- src/QsCompiler/Tests.LanguageServer/TestInput.cs | 2 +- src/QsCompiler/Tests.LanguageServer/TestSetup.cs | 2 +- src/QsCompiler/Tests.LanguageServer/TestUtils.cs | 2 +- src/QsCompiler/Tests.LanguageServer/Tests.cs | 2 +- src/QsCompiler/Transformations/Attributes.cs | 5 ++++- src/QsCompiler/Transformations/BasicTransformations.cs | 2 +- src/QsCompiler/Transformations/CodeTransformations.cs | 2 +- src/QsCompiler/Transformations/Conjugations.cs | 2 +- src/QsCompiler/Transformations/ContentLifting.cs | 2 +- src/QsCompiler/Transformations/FunctorGeneration.cs | 2 +- src/QsCompiler/Transformations/IntrinsicResolution.cs | 2 +- src/QsCompiler/Transformations/Monomorphization.cs | 2 +- .../Transformations/MonomorphizationValidation.cs | 2 +- src/QsCompiler/Transformations/Properties/AssemblyInfo.cs | 2 +- src/QsCompiler/Transformations/QsharpCodeOutput.cs | 2 +- src/QsCompiler/Transformations/SearchAndReplace.cs | 2 +- src/QsCompiler/Transformations/Utils.cs | 5 ++++- 90 files changed, 107 insertions(+), 108 deletions(-) diff --git a/.editorconfig b/.editorconfig index b2f45b23ef..286400054f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -45,13 +45,8 @@ dotnet_diagnostic.SA1513.severity = none # Closing brace should be follow dotnet_diagnostic.SA1515.severity = none # Single-line comment should be preceded by blank line # StyleCop: Documentation Rules -dotnet_diagnostic.SA1611.severity = none # Element parameters should be documented -dotnet_diagnostic.SA1612.severity = none # Element parameter documentation should match element parameters -dotnet_diagnostic.SA1615.severity = none # Element return value should be documented -dotnet_diagnostic.SA1618.severity = none # Generic type parameters should be documented dotnet_diagnostic.SA1623.severity = none # Property summary documentation should match accessors dotnet_diagnostic.SA1629.severity = none # Documentation text should end with a period -dotnet_diagnostic.SA1633.severity = none # File should have header dotnet_diagnostic.SA1642.severity = none # Constructor summary documentation should begin with standard text dotnet_diagnostic.SA1649.severity = none # File name should match first type name diff --git a/src/Common/DelaySign.cs b/src/Common/DelaySign.cs index a4cf6a944a..52ea7deb9c 100644 --- a/src/Common/DelaySign.cs +++ b/src/Common/DelaySign.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #if SIGNED diff --git a/src/Common/SigningConstants.cs b/src/Common/SigningConstants.cs index cd9b7b4575..4281d3f069 100644 --- a/src/Common/SigningConstants.cs +++ b/src/Common/SigningConstants.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. internal static class SigningConstants diff --git a/src/Common/stylecop.json b/src/Common/stylecop.json index 403d4cd116..842a141412 100644 --- a/src/Common/stylecop.json +++ b/src/Common/stylecop.json @@ -5,7 +5,11 @@ "usingDirectivesPlacement": "preserve" }, "documentationRules": { - "documentInternalElements": false + "copyrightText": "Copyright (c) Microsoft Corporation.\nLicensed under the MIT License.", + "documentInterfaces": false, + "documentExposedElements": false, + "documentInternalElements": false, + "xmlHeader": false } } } diff --git a/src/Documentation/DocumentationParser/DocBuilder.cs b/src/Documentation/DocumentationParser/DocBuilder.cs index 7085d4ac48..2f4a556101 100644 --- a/src/Documentation/DocumentationParser/DocBuilder.cs +++ b/src/Documentation/DocumentationParser/DocBuilder.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/Documentation/DocumentationParser/DocCallable.cs b/src/Documentation/DocumentationParser/DocCallable.cs index 8ecd08a5cc..c54e063f58 100644 --- a/src/Documentation/DocumentationParser/DocCallable.cs +++ b/src/Documentation/DocumentationParser/DocCallable.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/Documentation/DocumentationParser/DocItem.cs b/src/Documentation/DocumentationParser/DocItem.cs index 43b71c9867..1115cda84a 100644 --- a/src/Documentation/DocumentationParser/DocItem.cs +++ b/src/Documentation/DocumentationParser/DocItem.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/Documentation/DocumentationParser/DocNamespace.cs b/src/Documentation/DocumentationParser/DocNamespace.cs index 5da2efccf2..de54e3e65a 100644 --- a/src/Documentation/DocumentationParser/DocNamespace.cs +++ b/src/Documentation/DocumentationParser/DocNamespace.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #nullable enable diff --git a/src/Documentation/DocumentationParser/DocUdt.cs b/src/Documentation/DocumentationParser/DocUdt.cs index 67f9f77aac..8a5509dbdb 100644 --- a/src/Documentation/DocumentationParser/DocUdt.cs +++ b/src/Documentation/DocumentationParser/DocUdt.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.IO; diff --git a/src/Documentation/DocumentationParser/Properties/AssemblyInfo.cs b/src/Documentation/DocumentationParser/Properties/AssemblyInfo.cs index 4f44fd476e..7663d6de68 100644 --- a/src/Documentation/DocumentationParser/Properties/AssemblyInfo.cs +++ b/src/Documentation/DocumentationParser/Properties/AssemblyInfo.cs @@ -1,6 +1,7 @@ -using System.Reflection; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; // Allow the test assembly to use our internal methods [assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.QsDocumentationParser" + SigningConstants.PublicKey)] diff --git a/src/Documentation/DocumentationParser/Utils.cs b/src/Documentation/DocumentationParser/Utils.cs index 21e6b69372..83041d546a 100644 --- a/src/Documentation/DocumentationParser/Utils.cs +++ b/src/Documentation/DocumentationParser/Utils.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/Documentation/Tests.DocGenerator/DocParsingTests.cs b/src/Documentation/Tests.DocGenerator/DocParsingTests.cs index 5825d6a6f3..41548e1da6 100644 --- a/src/Documentation/Tests.DocGenerator/DocParsingTests.cs +++ b/src/Documentation/Tests.DocGenerator/DocParsingTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/Documentation/Tests.DocGenerator/DocWritingTests.cs b/src/Documentation/Tests.DocGenerator/DocWritingTests.cs index df89132757..4868411a3a 100644 --- a/src/Documentation/Tests.DocGenerator/DocWritingTests.cs +++ b/src/Documentation/Tests.DocGenerator/DocWritingTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/Documentation/Tests.DocGenerator/Utils.cs b/src/Documentation/Tests.DocGenerator/Utils.cs index 0d6ea3f5a1..a110ed698e 100644 --- a/src/Documentation/Tests.DocGenerator/Utils.cs +++ b/src/Documentation/Tests.DocGenerator/Utils.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.Quantum.QsCompiler.DataTypes; diff --git a/src/QsCompiler/CommandLineTool/Commands/Build.cs b/src/QsCompiler/CommandLineTool/Commands/Build.cs index 7b567c1124..4e22406bca 100644 --- a/src/QsCompiler/CommandLineTool/Commands/Build.cs +++ b/src/QsCompiler/CommandLineTool/Commands/Build.cs @@ -10,7 +10,6 @@ using CommandLine; using CommandLine.Text; using Microsoft.Quantum.QsCompiler.Diagnostics; -using static Microsoft.Quantum.QsCompiler.ReservedKeywords.AssemblyConstants; namespace Microsoft.Quantum.QsCompiler.CommandLineCompiler { @@ -47,7 +46,7 @@ public static IEnumerable UsageExamples Required = true, SetName = Options.ResponseFiles, HelpText = "Response file(s) providing command arguments. Required only if no other arguments are specified. Non-default values for options specified via command line take precedence.")] - public IEnumerable ResponseFiles { get; set; } + public new IEnumerable ResponseFiles { get; set; } [Option( 'o', diff --git a/src/QsCompiler/CommandLineTool/Commands/Diagnose.cs b/src/QsCompiler/CommandLineTool/Commands/Diagnose.cs index d0e82e27ec..455c714d16 100644 --- a/src/QsCompiler/CommandLineTool/Commands/Diagnose.cs +++ b/src/QsCompiler/CommandLineTool/Commands/Diagnose.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CommandLineTool/Commands/Format.cs b/src/QsCompiler/CommandLineTool/Commands/Format.cs index 7d4f79e491..3c1023066f 100644 --- a/src/QsCompiler/CommandLineTool/Commands/Format.cs +++ b/src/QsCompiler/CommandLineTool/Commands/Format.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -9,7 +9,6 @@ using System.Text.RegularExpressions; using CommandLine; using CommandLine.Text; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.Diagnostics; using Microsoft.Quantum.QsCompiler.Transformations.BasicTransformations; using Microsoft.Quantum.QsCompiler.Transformations.QsCodeOutput; diff --git a/src/QsCompiler/CommandLineTool/CompilationTracker.cs b/src/QsCompiler/CommandLineTool/CompilationTracker.cs index 4f832055d9..dad8ad8057 100644 --- a/src/QsCompiler/CommandLineTool/CompilationTracker.cs +++ b/src/QsCompiler/CommandLineTool/CompilationTracker.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CommandLineTool/LoadContext.cs b/src/QsCompiler/CommandLineTool/LoadContext.cs index 844ab10f32..484188d1e8 100644 --- a/src/QsCompiler/CommandLineTool/LoadContext.cs +++ b/src/QsCompiler/CommandLineTool/LoadContext.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. // This unfortunately needs to live in this project diff --git a/src/QsCompiler/CommandLineTool/Logging.cs b/src/QsCompiler/CommandLineTool/Logging.cs index 38f6070b99..4101b2a036 100644 --- a/src/QsCompiler/CommandLineTool/Logging.cs +++ b/src/QsCompiler/CommandLineTool/Logging.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CommandLineTool/Options.cs b/src/QsCompiler/CommandLineTool/Options.cs index 225c335213..ca720c8a47 100644 --- a/src/QsCompiler/CommandLineTool/Options.cs +++ b/src/QsCompiler/CommandLineTool/Options.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -9,7 +9,6 @@ using System.Reflection; using CommandLine; using Microsoft.Quantum.QsCompiler.CompilationBuilder; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.Diagnostics; using Microsoft.Quantum.QsCompiler.ReservedKeywords; using Microsoft.VisualStudio.LanguageServer.Protocol; diff --git a/src/QsCompiler/CommandLineTool/Program.cs b/src/QsCompiler/CommandLineTool/Program.cs index 73e08e1adc..1d3f0c58b4 100644 --- a/src/QsCompiler/CommandLineTool/Program.cs +++ b/src/QsCompiler/CommandLineTool/Program.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/AssemblyLoader.cs b/src/QsCompiler/CompilationManager/AssemblyLoader.cs index 7b9d4b30c5..bad4a18a42 100644 --- a/src/QsCompiler/CompilationManager/AssemblyLoader.cs +++ b/src/QsCompiler/CompilationManager/AssemblyLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/CompilationUnitManager.cs b/src/QsCompiler/CompilationManager/CompilationUnitManager.cs index 46946fa980..eabf9a11bc 100644 --- a/src/QsCompiler/CompilationManager/CompilationUnitManager.cs +++ b/src/QsCompiler/CompilationManager/CompilationUnitManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -10,8 +10,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Quantum.QsCompiler.CompilationBuilder.DataStructures; -using Microsoft.Quantum.QsCompiler.DataTypes; -using Microsoft.Quantum.QsCompiler.ReservedKeywords; using Microsoft.Quantum.QsCompiler.SyntaxProcessing; using Microsoft.Quantum.QsCompiler.SyntaxTokens; using Microsoft.Quantum.QsCompiler.SyntaxTree; diff --git a/src/QsCompiler/CompilationManager/ContextBuilder.cs b/src/QsCompiler/CompilationManager/ContextBuilder.cs index dc61f04d54..a0a6755da7 100644 --- a/src/QsCompiler/CompilationManager/ContextBuilder.cs +++ b/src/QsCompiler/CompilationManager/ContextBuilder.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/DataStructures.cs b/src/QsCompiler/CompilationManager/DataStructures.cs index f905b93d2f..ba448ea3e7 100644 --- a/src/QsCompiler/CompilationManager/DataStructures.cs +++ b/src/QsCompiler/CompilationManager/DataStructures.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/DiagnosticTools.cs b/src/QsCompiler/CompilationManager/DiagnosticTools.cs index eb07bec3be..db7157cb4a 100644 --- a/src/QsCompiler/CompilationManager/DiagnosticTools.cs +++ b/src/QsCompiler/CompilationManager/DiagnosticTools.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/Diagnostics.cs b/src/QsCompiler/CompilationManager/Diagnostics.cs index 8693cdd59f..be8b7c4cfa 100644 --- a/src/QsCompiler/CompilationManager/Diagnostics.cs +++ b/src/QsCompiler/CompilationManager/Diagnostics.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/EditorSupport/CodeActions.cs b/src/QsCompiler/CompilationManager/EditorSupport/CodeActions.cs index 7dd65a64e4..cd682f722d 100644 --- a/src/QsCompiler/CompilationManager/EditorSupport/CodeActions.cs +++ b/src/QsCompiler/CompilationManager/EditorSupport/CodeActions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -7,7 +7,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.Quantum.QsCompiler.CompilationBuilder.DataStructures; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.Diagnostics; using Microsoft.Quantum.QsCompiler.SyntaxProcessing; using Microsoft.Quantum.QsCompiler.SyntaxTokens; diff --git a/src/QsCompiler/CompilationManager/EditorSupport/CodeCompletion.cs b/src/QsCompiler/CompilationManager/EditorSupport/CodeCompletion.cs index 768592e90d..0466308d32 100644 --- a/src/QsCompiler/CompilationManager/EditorSupport/CodeCompletion.cs +++ b/src/QsCompiler/CompilationManager/EditorSupport/CodeCompletion.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/EditorSupport/EditorCommands.cs b/src/QsCompiler/CompilationManager/EditorSupport/EditorCommands.cs index 4fc6481d7d..b5039d2757 100644 --- a/src/QsCompiler/CompilationManager/EditorSupport/EditorCommands.cs +++ b/src/QsCompiler/CompilationManager/EditorSupport/EditorCommands.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/EditorSupport/SymbolInformation.cs b/src/QsCompiler/CompilationManager/EditorSupport/SymbolInformation.cs index 22788ee3fb..e34b380a45 100644 --- a/src/QsCompiler/CompilationManager/EditorSupport/SymbolInformation.cs +++ b/src/QsCompiler/CompilationManager/EditorSupport/SymbolInformation.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -7,7 +7,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.Quantum.QsCompiler.CompilationBuilder.DataStructures; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.SyntaxProcessing; using Microsoft.Quantum.QsCompiler.SyntaxTokens; using Microsoft.Quantum.QsCompiler.SyntaxTree; diff --git a/src/QsCompiler/CompilationManager/FileContentException.cs b/src/QsCompiler/CompilationManager/FileContentException.cs index f710b9e80a..fc1ffa8b56 100644 --- a/src/QsCompiler/CompilationManager/FileContentException.cs +++ b/src/QsCompiler/CompilationManager/FileContentException.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; namespace Microsoft.Quantum.QsCompiler.CompilationBuilder { diff --git a/src/QsCompiler/CompilationManager/FileContentManager.cs b/src/QsCompiler/CompilationManager/FileContentManager.cs index 301d137a0c..a1a821b566 100644 --- a/src/QsCompiler/CompilationManager/FileContentManager.cs +++ b/src/QsCompiler/CompilationManager/FileContentManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -9,7 +9,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Quantum.QsCompiler.CompilationBuilder.DataStructures; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.Diagnostics; using Microsoft.Quantum.QsCompiler.ReservedKeywords; using Microsoft.Quantum.QsCompiler.SyntaxProcessing; diff --git a/src/QsCompiler/CompilationManager/PerformanceTracking.cs b/src/QsCompiler/CompilationManager/PerformanceTracking.cs index 2221591b4e..c3effc62cc 100644 --- a/src/QsCompiler/CompilationManager/PerformanceTracking.cs +++ b/src/QsCompiler/CompilationManager/PerformanceTracking.cs @@ -1,12 +1,10 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.Text.RegularExpressions; -#nullable enable - namespace Microsoft.Quantum.QsCompiler.Diagnostics { /// diff --git a/src/QsCompiler/CompilationManager/ProcessingQueue.cs b/src/QsCompiler/CompilationManager/ProcessingQueue.cs index 0f438a71c3..20088f2d18 100644 --- a/src/QsCompiler/CompilationManager/ProcessingQueue.cs +++ b/src/QsCompiler/CompilationManager/ProcessingQueue.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/ProjectManager.cs b/src/QsCompiler/CompilationManager/ProjectManager.cs index d779a460cd..3c7ba21835 100644 --- a/src/QsCompiler/CompilationManager/ProjectManager.cs +++ b/src/QsCompiler/CompilationManager/ProjectManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/Properties/AssemblyInfo.cs b/src/QsCompiler/CompilationManager/Properties/AssemblyInfo.cs index a12ed9564a..1e0a5beaa3 100644 --- a/src/QsCompiler/CompilationManager/Properties/AssemblyInfo.cs +++ b/src/QsCompiler/CompilationManager/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Runtime.CompilerServices; diff --git a/src/QsCompiler/CompilationManager/ScopeTracking.cs b/src/QsCompiler/CompilationManager/ScopeTracking.cs index 564009edd9..23032393bf 100644 --- a/src/QsCompiler/CompilationManager/ScopeTracking.cs +++ b/src/QsCompiler/CompilationManager/ScopeTracking.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -6,7 +6,6 @@ using System.Linq; using Microsoft.Quantum.QsCompiler.CompilationBuilder.DataStructures; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Lsp = Microsoft.VisualStudio.LanguageServer.Protocol; using Position = Microsoft.Quantum.QsCompiler.DataTypes.Position; namespace Microsoft.Quantum.QsCompiler.CompilationBuilder diff --git a/src/QsCompiler/CompilationManager/TextProcessor.cs b/src/QsCompiler/CompilationManager/TextProcessor.cs index 27846f789d..cf5f69d5bd 100644 --- a/src/QsCompiler/CompilationManager/TextProcessor.cs +++ b/src/QsCompiler/CompilationManager/TextProcessor.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/TypeChecking.cs b/src/QsCompiler/CompilationManager/TypeChecking.cs index 4c9e2f4fad..0ae4ca4fb2 100644 --- a/src/QsCompiler/CompilationManager/TypeChecking.cs +++ b/src/QsCompiler/CompilationManager/TypeChecking.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/CompilationManager/Utils.cs b/src/QsCompiler/CompilationManager/Utils.cs index dc27e478e7..4c0874539a 100644 --- a/src/QsCompiler/CompilationManager/Utils.cs +++ b/src/QsCompiler/CompilationManager/Utils.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Compiler/FunctorGeneration.cs b/src/QsCompiler/Compiler/FunctorGeneration.cs index 180103efee..6de8aa5b86 100644 --- a/src/QsCompiler/Compiler/FunctorGeneration.cs +++ b/src/QsCompiler/Compiler/FunctorGeneration.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Compiler/LoadedStep.cs b/src/QsCompiler/Compiler/LoadedStep.cs index 8e35a124a6..6e533cf18f 100644 --- a/src/QsCompiler/Compiler/LoadedStep.cs +++ b/src/QsCompiler/Compiler/LoadedStep.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Compiler/Logging.cs b/src/QsCompiler/Compiler/Logging.cs index c706db4d08..68fb6471c0 100644 --- a/src/QsCompiler/Compiler/Logging.cs +++ b/src/QsCompiler/Compiler/Logging.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Compiler/MetadataGeneration.cs b/src/QsCompiler/Compiler/MetadataGeneration.cs index 3b04e9929b..87b5c16338 100644 --- a/src/QsCompiler/Compiler/MetadataGeneration.cs +++ b/src/QsCompiler/Compiler/MetadataGeneration.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; diff --git a/src/QsCompiler/Compiler/PluginInterface.cs b/src/QsCompiler/Compiler/PluginInterface.cs index 9e02dc8d20..b329f36330 100644 --- a/src/QsCompiler/Compiler/PluginInterface.cs +++ b/src/QsCompiler/Compiler/PluginInterface.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; diff --git a/src/QsCompiler/Compiler/Process.cs b/src/QsCompiler/Compiler/Process.cs index 149f3f28c2..d7709fdafc 100644 --- a/src/QsCompiler/Compiler/Process.cs +++ b/src/QsCompiler/Compiler/Process.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Compiler/Properties/AssemblyInfo.cs b/src/QsCompiler/Compiler/Properties/AssemblyInfo.cs index 091d227001..60ccd5c1f5 100644 --- a/src/QsCompiler/Compiler/Properties/AssemblyInfo.cs +++ b/src/QsCompiler/Compiler/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Runtime.CompilerServices; diff --git a/src/QsCompiler/Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs index 898561a421..8c00a208af 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/AbstractRewriteStepsLoader.cs @@ -1,8 +1,7 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; -using System.Collections.Immutable; using System.Linq; using Microsoft.Quantum.QsCompiler.CompilationBuilder; using Microsoft.Quantum.QsCompiler.Diagnostics; diff --git a/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs index 39e331a5a1..155ecb09db 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Compiler/RewriteSteps/CapabilityInference.cs b/src/QsCompiler/Compiler/RewriteSteps/CapabilityInference.cs index 396a75f6ab..ec8aa9a0d0 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/CapabilityInference.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/CapabilityInference.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Collections.Generic; using System.Linq; using Microsoft.Quantum.QsCompiler.SyntaxTree; diff --git a/src/QsCompiler/Compiler/RewriteSteps/ClassicallyControlled.cs b/src/QsCompiler/Compiler/RewriteSteps/ClassicallyControlled.cs index ca5dd76728..9d7ec981a3 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/ClassicallyControlled.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/ClassicallyControlled.cs @@ -1,10 +1,9 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.SyntaxTree; using Microsoft.Quantum.QsCompiler.Transformations.ClassicallyControlled; diff --git a/src/QsCompiler/Compiler/RewriteSteps/ConjugationInlining.cs b/src/QsCompiler/Compiler/RewriteSteps/ConjugationInlining.cs index c4af9007b5..96db84275f 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/ConjugationInlining.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/ConjugationInlining.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; diff --git a/src/QsCompiler/Compiler/RewriteSteps/ExternalRewriteStepsManager.cs b/src/QsCompiler/Compiler/RewriteSteps/ExternalRewriteStepsManager.cs index 192fc5434a..14b0fe8a03 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/ExternalRewriteStepsManager.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/ExternalRewriteStepsManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Compiler/RewriteSteps/FullPreEvaluation.cs b/src/QsCompiler/Compiler/RewriteSteps/FullPreEvaluation.cs index 0dc7e5c83b..b074e354f8 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/FullPreEvaluation.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/FullPreEvaluation.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; diff --git a/src/QsCompiler/Compiler/RewriteSteps/FunctorGeneration.cs b/src/QsCompiler/Compiler/RewriteSteps/FunctorGeneration.cs index 9d3b958ac4..fe192ccb6a 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/FunctorGeneration.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/FunctorGeneration.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; diff --git a/src/QsCompiler/Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs index eeeda0910e..714b17f723 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Compiler/RewriteSteps/IntrinsicResolution.cs b/src/QsCompiler/Compiler/RewriteSteps/IntrinsicResolution.cs index 6e9f4de3d7..18c38df7fd 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/IntrinsicResolution.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/IntrinsicResolution.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; diff --git a/src/QsCompiler/Compiler/RewriteSteps/Monomorphization.cs b/src/QsCompiler/Compiler/RewriteSteps/Monomorphization.cs index 1c4b387e16..1e52ab7953 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/Monomorphization.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/Monomorphization.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; diff --git a/src/QsCompiler/Compiler/RewriteSteps/TypeRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/TypeRewriteStepsLoader.cs index 1bd9257ec5..c2a89cc040 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/TypeRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/TypeRewriteStepsLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/LanguageServer/Communication.cs b/src/QsCompiler/LanguageServer/Communication.cs index 41d48bee22..665e752c85 100644 --- a/src/QsCompiler/LanguageServer/Communication.cs +++ b/src/QsCompiler/LanguageServer/Communication.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Runtime.Serialization; diff --git a/src/QsCompiler/LanguageServer/EditorState.cs b/src/QsCompiler/LanguageServer/EditorState.cs index b01c0ea44f..6f23c9556a 100644 --- a/src/QsCompiler/LanguageServer/EditorState.cs +++ b/src/QsCompiler/LanguageServer/EditorState.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/LanguageServer/EventQueues.cs b/src/QsCompiler/LanguageServer/EventQueues.cs index 2dd638a840..3800ab572c 100644 --- a/src/QsCompiler/LanguageServer/EventQueues.cs +++ b/src/QsCompiler/LanguageServer/EventQueues.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/LanguageServer/FileSystemWatcher.cs b/src/QsCompiler/LanguageServer/FileSystemWatcher.cs index 0440f99f1f..2c53700abb 100644 --- a/src/QsCompiler/LanguageServer/FileSystemWatcher.cs +++ b/src/QsCompiler/LanguageServer/FileSystemWatcher.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/LanguageServer/LanguageServer.cs b/src/QsCompiler/LanguageServer/LanguageServer.cs index ccb10ad6c3..7c6847f642 100644 --- a/src/QsCompiler/LanguageServer/LanguageServer.cs +++ b/src/QsCompiler/LanguageServer/LanguageServer.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/LanguageServer/Program.cs b/src/QsCompiler/LanguageServer/Program.cs index 23c7a73df2..8e9c64dcfa 100644 --- a/src/QsCompiler/LanguageServer/Program.cs +++ b/src/QsCompiler/LanguageServer/Program.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/LanguageServer/ProjectLoader.cs b/src/QsCompiler/LanguageServer/ProjectLoader.cs index e1c2576e52..acc837ecc7 100644 --- a/src/QsCompiler/LanguageServer/ProjectLoader.cs +++ b/src/QsCompiler/LanguageServer/ProjectLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/LanguageServer/Properties/AssemblyInfo.cs b/src/QsCompiler/LanguageServer/Properties/AssemblyInfo.cs index 932d13cc8c..9c8311fd6c 100644 --- a/src/QsCompiler/LanguageServer/Properties/AssemblyInfo.cs +++ b/src/QsCompiler/LanguageServer/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Runtime.CompilerServices; diff --git a/src/QsCompiler/LanguageServer/SynchronizationContext.cs b/src/QsCompiler/LanguageServer/SynchronizationContext.cs index caaf7bd7c3..7fa08144dd 100644 --- a/src/QsCompiler/LanguageServer/SynchronizationContext.cs +++ b/src/QsCompiler/LanguageServer/SynchronizationContext.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Threading; diff --git a/src/QsCompiler/LanguageServer/Utils.cs b/src/QsCompiler/LanguageServer/Utils.cs index f7c5425d77..fb0e5d6547 100644 --- a/src/QsCompiler/LanguageServer/Utils.cs +++ b/src/QsCompiler/LanguageServer/Utils.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/TestTargets/Simulation/Target/Program.cs b/src/QsCompiler/TestTargets/Simulation/Target/Program.cs index 1c330415d6..f5f5d52080 100644 --- a/src/QsCompiler/TestTargets/Simulation/Target/Program.cs +++ b/src/QsCompiler/TestTargets/Simulation/Target/Program.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; diff --git a/src/QsCompiler/Tests.LanguageServer/ProjectLoaderTests.cs b/src/QsCompiler/Tests.LanguageServer/ProjectLoaderTests.cs index 562030ff8e..077dd99fee 100644 --- a/src/QsCompiler/Tests.LanguageServer/ProjectLoaderTests.cs +++ b/src/QsCompiler/Tests.LanguageServer/ProjectLoaderTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Tests.LanguageServer/TestInput.cs b/src/QsCompiler/Tests.LanguageServer/TestInput.cs index 4e4053916b..61b82b720a 100644 --- a/src/QsCompiler/Tests.LanguageServer/TestInput.cs +++ b/src/QsCompiler/Tests.LanguageServer/TestInput.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Tests.LanguageServer/TestSetup.cs b/src/QsCompiler/Tests.LanguageServer/TestSetup.cs index 4ee4cbd245..e31eda192f 100644 --- a/src/QsCompiler/Tests.LanguageServer/TestSetup.cs +++ b/src/QsCompiler/Tests.LanguageServer/TestSetup.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Tests.LanguageServer/TestUtils.cs b/src/QsCompiler/Tests.LanguageServer/TestUtils.cs index 3c8163e905..f1b8114ef7 100644 --- a/src/QsCompiler/Tests.LanguageServer/TestUtils.cs +++ b/src/QsCompiler/Tests.LanguageServer/TestUtils.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Tests.LanguageServer/Tests.cs b/src/QsCompiler/Tests.LanguageServer/Tests.cs index b5644cd652..b7bfe4f3a5 100644 --- a/src/QsCompiler/Tests.LanguageServer/Tests.cs +++ b/src/QsCompiler/Tests.LanguageServer/Tests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/Attributes.cs b/src/QsCompiler/Transformations/Attributes.cs index 48cddd323d..d86fdc07d8 100644 --- a/src/QsCompiler/Transformations/Attributes.cs +++ b/src/QsCompiler/Transformations/Attributes.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; diff --git a/src/QsCompiler/Transformations/BasicTransformations.cs b/src/QsCompiler/Transformations/BasicTransformations.cs index 8eb7e4200d..63e7114892 100644 --- a/src/QsCompiler/Transformations/BasicTransformations.cs +++ b/src/QsCompiler/Transformations/BasicTransformations.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/CodeTransformations.cs b/src/QsCompiler/Transformations/CodeTransformations.cs index 7e9f6d0eba..6162120319 100644 --- a/src/QsCompiler/Transformations/CodeTransformations.cs +++ b/src/QsCompiler/Transformations/CodeTransformations.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/Conjugations.cs b/src/QsCompiler/Transformations/Conjugations.cs index 35df51eee7..88906b0d24 100644 --- a/src/QsCompiler/Transformations/Conjugations.cs +++ b/src/QsCompiler/Transformations/Conjugations.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/ContentLifting.cs b/src/QsCompiler/Transformations/ContentLifting.cs index db892bfda9..3f89a048ef 100644 --- a/src/QsCompiler/Transformations/ContentLifting.cs +++ b/src/QsCompiler/Transformations/ContentLifting.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/FunctorGeneration.cs b/src/QsCompiler/Transformations/FunctorGeneration.cs index 4ca5e0c33c..31f5426e53 100644 --- a/src/QsCompiler/Transformations/FunctorGeneration.cs +++ b/src/QsCompiler/Transformations/FunctorGeneration.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/IntrinsicResolution.cs b/src/QsCompiler/Transformations/IntrinsicResolution.cs index 06a5763846..a05a5e3384 100644 --- a/src/QsCompiler/Transformations/IntrinsicResolution.cs +++ b/src/QsCompiler/Transformations/IntrinsicResolution.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/Monomorphization.cs b/src/QsCompiler/Transformations/Monomorphization.cs index e719643f1e..b1f97e4014 100644 --- a/src/QsCompiler/Transformations/Monomorphization.cs +++ b/src/QsCompiler/Transformations/Monomorphization.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/MonomorphizationValidation.cs b/src/QsCompiler/Transformations/MonomorphizationValidation.cs index 33e43a639c..491ad3d03c 100644 --- a/src/QsCompiler/Transformations/MonomorphizationValidation.cs +++ b/src/QsCompiler/Transformations/MonomorphizationValidation.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/Properties/AssemblyInfo.cs b/src/QsCompiler/Transformations/Properties/AssemblyInfo.cs index 73d743a24a..7edd056c4b 100644 --- a/src/QsCompiler/Transformations/Properties/AssemblyInfo.cs +++ b/src/QsCompiler/Transformations/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Runtime.CompilerServices; diff --git a/src/QsCompiler/Transformations/QsharpCodeOutput.cs b/src/QsCompiler/Transformations/QsharpCodeOutput.cs index b45f26fb0e..728a1210c3 100644 --- a/src/QsCompiler/Transformations/QsharpCodeOutput.cs +++ b/src/QsCompiler/Transformations/QsharpCodeOutput.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/SearchAndReplace.cs b/src/QsCompiler/Transformations/SearchAndReplace.cs index 3c9c131dcf..d85b3e964d 100644 --- a/src/QsCompiler/Transformations/SearchAndReplace.cs +++ b/src/QsCompiler/Transformations/SearchAndReplace.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; diff --git a/src/QsCompiler/Transformations/Utils.cs b/src/QsCompiler/Transformations/Utils.cs index 5bc891ccd0..f41fe01337 100644 --- a/src/QsCompiler/Transformations/Utils.cs +++ b/src/QsCompiler/Transformations/Utils.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Collections.Generic; using System.Linq; From e16d262d2f4e20340fc201d6bbcf39788168f246 Mon Sep 17 00:00:00 2001 From: Sarah Marshall Date: Wed, 6 Jan 2021 17:02:31 -0800 Subject: [PATCH 3/7] Re-enable some default rules --- .editorconfig | 2 -- src/QsCompiler/CommandLineTool/Program.cs | 3 ++- .../CompilationUnitManager.cs | 3 ++- .../FileContentException.cs | 3 ++- .../AssemblyRewriteStepsLoader.cs | 3 ++- .../InstanceRewriteStepsLoader.cs | 3 ++- .../RewriteSteps/TypeRewriteStepsLoader.cs | 3 ++- .../LanguageServer/LanguageServer.cs | 3 ++- src/QsCompiler/LanguageServer/Utils.cs | 3 ++- .../Transformations/BasicTransformations.cs | 6 +++-- .../CallGraph/CallGraphWalker.cs | 13 ++++++---- .../CallGraph/CallGraphWalkerBase.cs | 6 +++-- .../CallGraph/ConcreteCallGraph.cs | 4 ++-- .../CallGraph/ConcreteCallGraphWalker.cs | 12 ++++++---- .../Transformations/ClassicallyControlled.cs | 24 ++++++++++++------- .../Transformations/ContentLifting.cs | 24 ++++++++++++------- .../Transformations/Monomorphization.cs | 24 ++++++++++++------- .../MonomorphizationValidation.cs | 13 ++++++---- .../Transformations/SearchAndReplace.cs | 9 ++++--- .../TypeResolutionCombination.cs | 9 ++++--- 20 files changed, 110 insertions(+), 60 deletions(-) diff --git a/.editorconfig b/.editorconfig index 286400054f..c9abce4ed7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -21,8 +21,6 @@ dotnet_diagnostic.SA0001.severity = none # XML comment analysis disabled # StyleCop: Readability Rules dotnet_diagnostic.SA1118.severity = none # Parameter should not span multiple lines dotnet_diagnostic.SA1122.severity = none # Use string.Empty for empty strings -dotnet_diagnostic.SA1127.severity = none # Generic type constraints should be on their own line -dotnet_diagnostic.SA1128.severity = none # Put constructor initializers on their own line dotnet_diagnostic.SA1135.severity = none # Using directives should be qualified # StyleCop: Ordering Rules diff --git a/src/QsCompiler/CommandLineTool/Program.cs b/src/QsCompiler/CommandLineTool/Program.cs index 1d3f0c58b4..6f91c36ad6 100644 --- a/src/QsCompiler/CommandLineTool/Program.cs +++ b/src/QsCompiler/CommandLineTool/Program.cs @@ -86,7 +86,8 @@ public static int Status(CompilationLoader loaded) => public static class Program { - private static int Run(Func compile, T options) where T : Options + private static int Run(Func compile, T options) + where T : Options { var logger = options.GetLogger(); try diff --git a/src/QsCompiler/CompilationManager/CompilationUnitManager.cs b/src/QsCompiler/CompilationManager/CompilationUnitManager.cs index eabf9a11bc..f061fb89ef 100644 --- a/src/QsCompiler/CompilationManager/CompilationUnitManager.cs +++ b/src/QsCompiler/CompilationManager/CompilationUnitManager.cs @@ -94,7 +94,8 @@ public CompilationUnitManager( /// and then executes the given function, returning its result. /// Returns null if the given function to execute is null, but does everything else. /// - public T? FlushAndExecute(Func? execute = null) where T : class + public T? FlushAndExecute(Func? execute = null) + where T : class { // To enforce an up-to-date content for executing the given function, // we want to do a (synchronous!) global type checking on flushing, diff --git a/src/QsCompiler/CompilationManager/FileContentException.cs b/src/QsCompiler/CompilationManager/FileContentException.cs index fc1ffa8b56..fb685fd7ad 100644 --- a/src/QsCompiler/CompilationManager/FileContentException.cs +++ b/src/QsCompiler/CompilationManager/FileContentException.cs @@ -13,7 +13,8 @@ public class FileContentException : Exception /// /// Creates a with the given message. /// - public FileContentException(string message) : base(message) + public FileContentException(string message) + : base(message) { } } diff --git a/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs index 155ecb09db..ee8a4fbd13 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/AssemblyRewriteStepsLoader.cs @@ -20,7 +20,8 @@ namespace Microsoft.Quantum.QsCompiler /// internal class AssemblyRewriteStepsLoader : AbstractRewriteStepsLoader { - public AssemblyRewriteStepsLoader(Action? onDiagnostic = null, Action? onException = null) : base(onDiagnostic, onException) + public AssemblyRewriteStepsLoader(Action? onDiagnostic = null, Action? onException = null) + : base(onDiagnostic, onException) { } diff --git a/src/QsCompiler/Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs index 714b17f723..6b51574289 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/InstanceRewriteStepsLoader.cs @@ -13,7 +13,8 @@ namespace Microsoft.Quantum.QsCompiler /// internal class InstanceRewriteStepsLoader : AbstractRewriteStepsLoader { - public InstanceRewriteStepsLoader(Action? onDiagnostic = null, Action? onException = null) : base(onDiagnostic, onException) + public InstanceRewriteStepsLoader(Action? onDiagnostic = null, Action? onException = null) + : base(onDiagnostic, onException) { } diff --git a/src/QsCompiler/Compiler/RewriteSteps/TypeRewriteStepsLoader.cs b/src/QsCompiler/Compiler/RewriteSteps/TypeRewriteStepsLoader.cs index c2a89cc040..dd2584d046 100644 --- a/src/QsCompiler/Compiler/RewriteSteps/TypeRewriteStepsLoader.cs +++ b/src/QsCompiler/Compiler/RewriteSteps/TypeRewriteStepsLoader.cs @@ -13,7 +13,8 @@ namespace Microsoft.Quantum.QsCompiler /// internal class TypeRewriteStepsLoader : AbstractRewriteStepsLoader { - public TypeRewriteStepsLoader(Action? onDiagnostic = null, Action? onException = null) : base(onDiagnostic, onException) + public TypeRewriteStepsLoader(Action? onDiagnostic = null, Action? onException = null) + : base(onDiagnostic, onException) { } diff --git a/src/QsCompiler/LanguageServer/LanguageServer.cs b/src/QsCompiler/LanguageServer/LanguageServer.cs index 7c6847f642..2bb16ce941 100644 --- a/src/QsCompiler/LanguageServer/LanguageServer.cs +++ b/src/QsCompiler/LanguageServer/LanguageServer.cs @@ -575,7 +575,8 @@ Command BuildCommand(string title, WorkspaceEdit edit) public object? OnExecuteCommand(JToken arg) { ExecuteCommandParams param = Utils.TryJTokenAs(arg); - object? CastAndExecute(Func command) where T : class => + object? CastAndExecute(Func command) + where T : class => QsCompilerError.RaiseOnFailure( () => command(Utils.TryJTokenAs((JObject)param.Arguments.Single())), // currently all supported commands take a single argument "ExecuteCommand threw an exception"); diff --git a/src/QsCompiler/LanguageServer/Utils.cs b/src/QsCompiler/LanguageServer/Utils.cs index fb0e5d6547..fe43424be8 100644 --- a/src/QsCompiler/LanguageServer/Utils.cs +++ b/src/QsCompiler/LanguageServer/Utils.cs @@ -17,7 +17,8 @@ public static class Utils // language server tools - // wrapping these into a try .. catch .. to make sure errors don't go unnoticed as they otherwise would - public static T TryJTokenAs(JToken arg) where T : class => + public static T TryJTokenAs(JToken arg) + where T : class => QsCompilerError.RaiseOnFailure(() => arg.ToObject(), "could not cast given JToken"); private static ShowMessageParams? AsMessageParams(string text, MessageType severity) => diff --git a/src/QsCompiler/Transformations/BasicTransformations.cs b/src/QsCompiler/Transformations/BasicTransformations.cs index 63e7114892..7ed7e457a7 100644 --- a/src/QsCompiler/Transformations/BasicTransformations.cs +++ b/src/QsCompiler/Transformations/BasicTransformations.cs @@ -221,7 +221,8 @@ public SelectByFoldingOverExpressions(Func condition, Fun // helper classes public class StatementTransformation - : Core.StatementTransformation where TSelector : SelectByFoldingOverExpressions + : Core.StatementTransformation + where TSelector : SelectByFoldingOverExpressions { protected TSelector? subSelector; protected readonly Func CreateSelector; @@ -305,7 +306,8 @@ public SelectByAllContainedExpressions(Func condition, bo /// The transformation itself merely walks expressions and rebuilding is disabled. /// public class FoldOverExpressions - : ExpressionTransformation where TState : FoldOverExpressions.IFoldingState + : ExpressionTransformation + where TState : FoldOverExpressions.IFoldingState { public interface IFoldingState { diff --git a/src/QsCompiler/Transformations/CallGraph/CallGraphWalker.cs b/src/QsCompiler/Transformations/CallGraph/CallGraphWalker.cs index ab0664ecd2..ca59f0efd1 100644 --- a/src/QsCompiler/Transformations/CallGraph/CallGraphWalker.cs +++ b/src/QsCompiler/Transformations/CallGraph/CallGraphWalker.cs @@ -16,7 +16,6 @@ namespace Microsoft.Quantum.QsCompiler.Transformations.CallGraphWalker using ExpressionKind = QsExpressionKind; using GraphBuilder = CallGraphBuilder; using Range = DataTypes.Range; - using TypeParameterResolutions = ImmutableDictionary, ResolvedType>; internal static partial class BuildCallGraph { @@ -96,7 +95,8 @@ public static void PopulateTrimmedGraph(GraphBuilder graph, QsCompilation compil private class BuildGraph : SyntaxTreeTransformation { - public BuildGraph(GraphBuilder graph) : base(new TransformationState(graph)) + public BuildGraph(GraphBuilder graph) + : base(new TransformationState(graph)) { this.Namespaces = new NamespaceWalker(this); this.Statements = new CallGraphWalkerBase.StatementWalker(this); @@ -112,7 +112,8 @@ private class TransformationState : CallGraphWalkerBase { - public NamespaceWalker(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public NamespaceWalker(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } @@ -168,7 +170,8 @@ public override QsCallable OnCallableDeclaration(QsCallable c) private class ExpressionKindWalker : ExpressionKindTransformation { - public ExpressionKindWalker(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public ExpressionKindWalker(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } diff --git a/src/QsCompiler/Transformations/CallGraph/CallGraphWalkerBase.cs b/src/QsCompiler/Transformations/CallGraph/CallGraphWalkerBase.cs index 35183c6a25..24c3cef84e 100644 --- a/src/QsCompiler/Transformations/CallGraph/CallGraphWalkerBase.cs +++ b/src/QsCompiler/Transformations/CallGraph/CallGraphWalkerBase.cs @@ -48,7 +48,8 @@ internal TransformationState(TGraph graph) public class StatementWalker : StatementTransformation where TState : TransformationState { - public StatementWalker(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public StatementWalker(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } @@ -65,7 +66,8 @@ public override QsStatement OnStatement(QsStatement stm) public class ExpressionWalker : ExpressionTransformation where TState : TransformationState { - public ExpressionWalker(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public ExpressionWalker(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } diff --git a/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraph.cs b/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraph.cs index 61c7e14198..9835e084fc 100644 --- a/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraph.cs +++ b/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraph.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Immutable; using System.Linq; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.SyntaxTree; using Microsoft.Quantum.QsCompiler.Transformations.CallGraphWalker; @@ -46,7 +45,8 @@ public sealed class ConcreteCallGraphNode : CallGraphNodeBase, IEquatable - public ConcreteCallGraphNode(QsQualifiedName callableName, QsSpecializationKind kind, TypeParameterResolutions paramResolutions) : base(callableName) + public ConcreteCallGraphNode(QsQualifiedName callableName, QsSpecializationKind kind, TypeParameterResolutions paramResolutions) + : base(callableName) { this.Kind = kind; diff --git a/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraphWalker.cs b/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraphWalker.cs index c7f8727031..93c204ec1b 100644 --- a/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraphWalker.cs +++ b/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraphWalker.cs @@ -154,7 +154,8 @@ private static QsSpecialization GetSpecializationFromRequest(ConcreteCallGraphNo private class BuildGraph : SyntaxTreeTransformation { - public BuildGraph(ConcreteGraphBuilder graph) : base(new TransformationState(graph)) + public BuildGraph(ConcreteGraphBuilder graph) + : base(new TransformationState(graph)) { this.Namespaces = new NamespaceWalker(this); this.Statements = new CallGraphWalkerBase.StatementWalker(this); @@ -173,7 +174,8 @@ private class TransformationState : CallGraphWalkerBase> GetSpecializationKinds = _ => Enumerable.Empty(); private Range lastReferenceRange = Range.Zero; // This is used if a self-inverse generator directive is encountered. - internal TransformationState(ConcreteGraphBuilder graph) : base(graph) + internal TransformationState(ConcreteGraphBuilder graph) + : base(graph) { } @@ -265,7 +267,8 @@ private void AddEdge(QsQualifiedName identifier, QsSpecializationKind kind, Type private class NamespaceWalker : NamespaceTransformation { - public NamespaceWalker(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public NamespaceWalker(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } @@ -302,7 +305,8 @@ public override QsGeneratorDirective OnGeneratedImplementation(QsGeneratorDirect private class ExpressionKindWalker : ExpressionKindTransformation { - public ExpressionKindWalker(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public ExpressionKindWalker(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } diff --git a/src/QsCompiler/Transformations/ClassicallyControlled.cs b/src/QsCompiler/Transformations/ClassicallyControlled.cs index 9e59912f17..839a5dcd93 100644 --- a/src/QsCompiler/Transformations/ClassicallyControlled.cs +++ b/src/QsCompiler/Transformations/ClassicallyControlled.cs @@ -40,7 +40,8 @@ private class RestructureConditions : SyntaxTreeTransformation public static QsCompilation Apply(QsCompilation compilation) => new RestructureConditions().OnCompilation(compilation); - private RestructureConditions() : base() + private RestructureConditions() + : base() { this.Namespaces = new NamespaceTransformation(this); this.Statements = new StatementTransformation(this); @@ -50,7 +51,8 @@ private RestructureConditions() : base() private class NamespaceTransformation : Core.NamespaceTransformation { - public NamespaceTransformation(SyntaxTreeTransformation parent) : base(parent) + public NamespaceTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -59,7 +61,8 @@ public NamespaceTransformation(SyntaxTreeTransformation parent) : base(parent) private class StatementTransformation : Core.StatementTransformation { - public StatementTransformation(SyntaxTreeTransformation parent) : base(parent) + public StatementTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -266,7 +269,8 @@ public TransformationState(QsCompilation compilation) } } - private ConvertConditions(QsCompilation compilation) : base(new TransformationState(compilation)) + private ConvertConditions(QsCompilation compilation) + : base(new TransformationState(compilation)) { this.Namespaces = new NamespaceTransformation(this); this.Statements = new StatementTransformation(this); @@ -276,7 +280,8 @@ private ConvertConditions(QsCompilation compilation) : base(new TransformationSt private class NamespaceTransformation : NamespaceTransformation { - public NamespaceTransformation(SyntaxTreeTransformation parent) : base(parent) + public NamespaceTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -285,7 +290,8 @@ public NamespaceTransformation(SyntaxTreeTransformation par private class StatementTransformation : StatementTransformation { - public StatementTransformation(SyntaxTreeTransformation parent) : base(parent) + public StatementTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -833,14 +839,16 @@ internal class TransformationState : ContentLifting.LiftContent.TransformationSt internal bool IsConditionLiftable = false; } - public LiftContent() : base(new TransformationState()) + public LiftContent() + : base(new TransformationState()) { this.StatementKinds = new StatementKindTransformation(this); } private new class StatementKindTransformation : ContentLifting.LiftContent.StatementKindTransformation { - public StatementKindTransformation(SyntaxTreeTransformation parent) : base(parent) + public StatementKindTransformation(SyntaxTreeTransformation parent) + : base(parent) { } diff --git a/src/QsCompiler/Transformations/ContentLifting.cs b/src/QsCompiler/Transformations/ContentLifting.cs index 3f89a048ef..8a62ca48d4 100644 --- a/src/QsCompiler/Transformations/ContentLifting.cs +++ b/src/QsCompiler/Transformations/ContentLifting.cs @@ -367,7 +367,8 @@ private UpdateGeneratedOp(ImmutableArray> param private class ExpressionTransformation : ExpressionTransformation { - public ExpressionTransformation(SyntaxTreeTransformation parent) : base(parent) + public ExpressionTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -404,7 +405,8 @@ public override TypedExpression OnTypedExpression(TypedExpression ex) private class ExpressionKindTransformation : ExpressionKindTransformation { - public ExpressionKindTransformation(SyntaxTreeTransformation parent) : base(parent) + public ExpressionKindTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -427,7 +429,8 @@ public override ExpressionKind OnIdentifier(Identifier sym, QsNullable { - public TypeTransformation(SyntaxTreeTransformation parent) : base(parent) + public TypeTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -463,7 +466,8 @@ public override ResolvedTypeKind OnTypeParameter(QsTypeParameter tp) public class LiftContent : SyntaxTreeTransformation where T : LiftContent.TransformationState { - protected LiftContent(T state) : base(state) + protected LiftContent(T state) + : base(state) { this.Namespaces = new NamespaceTransformation(this); this.StatementKinds = new StatementKindTransformation(this); @@ -474,7 +478,8 @@ protected LiftContent(T state) : base(state) protected class NamespaceTransformation : NamespaceTransformation { - public NamespaceTransformation(SyntaxTreeTransformation parent) : base(parent) + public NamespaceTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -537,7 +542,8 @@ public override QsNamespace OnNamespace(QsNamespace ns) protected class StatementKindTransformation : StatementKindTransformation { - public StatementKindTransformation(SyntaxTreeTransformation parent) : base(parent) + public StatementKindTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -586,7 +592,8 @@ public override QsStatementKind OnStatementKind(QsStatementKind kind) protected class ExpressionTransformation : ExpressionTransformation { - public ExpressionTransformation(SyntaxTreeTransformation parent) : base(parent) + public ExpressionTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -607,7 +614,8 @@ public override TypedExpression OnTypedExpression(TypedExpression ex) protected class ExpressionKindTransformation : ExpressionKindTransformation { - public ExpressionKindTransformation(SyntaxTreeTransformation parent) : base(parent) + public ExpressionKindTransformation(SyntaxTreeTransformation parent) + : base(parent) { } diff --git a/src/QsCompiler/Transformations/Monomorphization.cs b/src/QsCompiler/Transformations/Monomorphization.cs index b1f97e4014..983c1dadc9 100644 --- a/src/QsCompiler/Transformations/Monomorphization.cs +++ b/src/QsCompiler/Transformations/Monomorphization.cs @@ -130,7 +130,8 @@ private ResolveGenerics(ILookup namespaceCallables, Immutabl private class NamespaceTransformation : NamespaceTransformation { - public NamespaceTransformation(SyntaxTreeTransformation parent) : base(parent) + public NamespaceTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -204,7 +205,8 @@ private ReplaceTypeParamImplementations(TypeParameterResolutions typeParams, Get private class NamespaceTransformation : NamespaceTransformation { - public NamespaceTransformation(SyntaxTreeTransformation parent) : base(parent) + public NamespaceTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -243,7 +245,8 @@ public override ResolvedSignature OnSignature(ResolvedSignature s) private class ExpressionTransformation : ExpressionTransformation { - public ExpressionTransformation(SyntaxTreeTransformation parent) : base(parent) + public ExpressionTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -256,7 +259,8 @@ public override TypeParameterResolutions OnTypeParamResolutions(TypeParameterRes private class TypeTransformation : TypeTransformation { - public TypeTransformation(SyntaxTreeTransformation parent) : base(parent) + public TypeTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -372,7 +376,8 @@ private ReplaceTypeParamCalls(GetConcreteIdentifierFunc getConcreteIdentifier, I private class StatementTransformation : StatementTransformation { - public StatementTransformation(SyntaxTreeTransformation parent) : base(parent) + public StatementTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -386,7 +391,8 @@ public override QsStatement OnStatement(QsStatement stm) private class ExpressionTransformation : ExpressionTransformation { - public ExpressionTransformation(SyntaxTreeTransformation parent) : base(parent) + public ExpressionTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -410,7 +416,8 @@ public override TypeParameterResolutions OnTypeParamResolutions(TypeParameterRes private class ExpressionKindTransformation : ExpressionKindTransformation { - public ExpressionKindTransformation(SyntaxTreeTransformation parent) : base(parent) + public ExpressionKindTransformation(SyntaxTreeTransformation parent) + : base(parent) { } @@ -442,7 +449,8 @@ public override QsExpressionKind OnId private class TypeTransformation : TypeTransformation { - public TypeTransformation(SyntaxTreeTransformation parent) : base(parent) + public TypeTransformation(SyntaxTreeTransformation parent) + : base(parent) { } diff --git a/src/QsCompiler/Transformations/MonomorphizationValidation.cs b/src/QsCompiler/Transformations/MonomorphizationValidation.cs index 491ad3d03c..275ca5bf42 100644 --- a/src/QsCompiler/Transformations/MonomorphizationValidation.cs +++ b/src/QsCompiler/Transformations/MonomorphizationValidation.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Immutable; using System.Linq; -using Microsoft.Quantum.QsCompiler.DataTypes; using Microsoft.Quantum.QsCompiler.SyntaxTokens; using Microsoft.Quantum.QsCompiler.SyntaxTree; using Microsoft.Quantum.QsCompiler.Transformations.Core; @@ -33,7 +32,8 @@ public TransformationState(ImmutableHashSet intrinsicCallableSe } } - internal ValidateMonomorphization(ImmutableHashSet intrinsicCallableSet) : base(new TransformationState(intrinsicCallableSet)) + internal ValidateMonomorphization(ImmutableHashSet intrinsicCallableSet) + : base(new TransformationState(intrinsicCallableSet)) { this.Namespaces = new NamespaceTransformation(this); this.Statements = new StatementTransformation(this, TransformationOptions.NoRebuild); @@ -45,7 +45,8 @@ internal ValidateMonomorphization(ImmutableHashSet intrinsicCal private class NamespaceTransformation : NamespaceTransformation { - public NamespaceTransformation(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public NamespaceTransformation(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } @@ -75,7 +76,8 @@ public override ResolvedSignature OnSignature(ResolvedSignature s) private class ExpressionTransformation : ExpressionTransformation { - public ExpressionTransformation(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public ExpressionTransformation(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } @@ -93,7 +95,8 @@ public override ImmutableDictionary, ResolvedType private class TypeTransformation : TypeTransformation { - public TypeTransformation(SyntaxTreeTransformation parent) : base(parent, TransformationOptions.NoRebuild) + public TypeTransformation(SyntaxTreeTransformation parent) + : base(parent, TransformationOptions.NoRebuild) { } diff --git a/src/QsCompiler/Transformations/SearchAndReplace.cs b/src/QsCompiler/Transformations/SearchAndReplace.cs index d85b3e964d..24b4dd2b35 100644 --- a/src/QsCompiler/Transformations/SearchAndReplace.cs +++ b/src/QsCompiler/Transformations/SearchAndReplace.cs @@ -684,7 +684,8 @@ private class TypeTransformation : Core.TypeTransformation { private readonly TransformationState state; - public TypeTransformation(RenameReferences parent) : base(parent) => + public TypeTransformation(RenameReferences parent) + : base(parent) => this.state = parent.state; public override QsTypeKind OnUserDefinedType(UserDefinedType udt) => @@ -698,7 +699,8 @@ private class ExpressionKindTransformation : Core.ExpressionKindTransformation { private readonly TransformationState state; - public ExpressionKindTransformation(RenameReferences parent) : base(parent) => + public ExpressionKindTransformation(RenameReferences parent) + : base(parent) => this.state = parent.state; public override QsExpressionKind OnIdentifier(Identifier id, QsNullable> typeArgs) @@ -715,7 +717,8 @@ private class NamespaceTransformation : Core.NamespaceTransformation { private readonly TransformationState state; - public NamespaceTransformation(RenameReferences parent) : base(parent) => + public NamespaceTransformation(RenameReferences parent) + : base(parent) => this.state = parent.state; public override QsDeclarationAttribute OnAttribute(QsDeclarationAttribute attribute) diff --git a/src/QsCompiler/Transformations/TypeResolutionCombination.cs b/src/QsCompiler/Transformations/TypeResolutionCombination.cs index cd54e754ca..92b1758e8b 100644 --- a/src/QsCompiler/Transformations/TypeResolutionCombination.cs +++ b/src/QsCompiler/Transformations/TypeResolutionCombination.cs @@ -97,7 +97,8 @@ private static ILookup GetReplaceable(Type /// type parameter resolutions are relevant to the given expression's type parameter resolutions /// are considered. /// - public TypeResolutionCombination(TypedExpression expression) : this(GetTypeParameterResolutions.Apply(expression)) + public TypeResolutionCombination(TypedExpression expression) + : this(GetTypeParameterResolutions.Apply(expression)) { } @@ -264,7 +265,8 @@ internal class TransformationState public HashSet TypeParams = new HashSet(); } - private GetTypeParameters() : base(new TransformationState(), TransformationOptions.NoRebuild) + private GetTypeParameters() + : base(new TransformationState(), TransformationOptions.NoRebuild) { } @@ -370,7 +372,8 @@ internal class TransformationState public bool InCallLike = false; } - private GetTypeParameterResolutions() : base(new TransformationState(), TransformationOptions.NoRebuild) + private GetTypeParameterResolutions() + : base(new TransformationState(), TransformationOptions.NoRebuild) { } From 17eca07cf3004805d56452158c2dc880e22f181c Mon Sep 17 00:00:00 2001 From: Sarah Marshall Date: Wed, 6 Jan 2021 17:15:52 -0800 Subject: [PATCH 4/7] Add StyleCop to AssemblyCommon.props --- src/Common/AssemblyCommon.props | 5 +++++ .../DocumentationGenerator/DocumentationGenerator.csproj | 5 ----- .../DocumentationParser/DocumentationParser.csproj | 5 ----- .../Tests.DocGenerator/Tests.DocGenerator.csproj | 5 ----- src/QsCompiler/BondSchemas/BondSchemaTranslator.cs | 4 ++-- src/QsCompiler/BondSchemas/BondSchemas.csproj | 4 ---- src/QsCompiler/BondSchemas/CompilerObjectTranslator.cs | 8 ++++---- src/QsCompiler/BondSchemas/Protocols.cs | 6 +++--- src/QsCompiler/CommandLineTool/CommandLineTool.csproj | 2 -- .../CompilationManager/CompilationManager.csproj | 5 ----- src/QsCompiler/Compiler/Compiler.csproj | 5 ----- src/QsCompiler/LanguageServer/LanguageServer.csproj | 4 ---- .../TestTargets/Simulation/Target/Simulation.csproj | 5 ----- .../Tests.LanguageServer/Tests.LanguageServer.csproj | 5 ----- src/QsCompiler/Transformations/Transformations.csproj | 8 -------- 15 files changed, 14 insertions(+), 62 deletions(-) diff --git a/src/Common/AssemblyCommon.props b/src/Common/AssemblyCommon.props index 43b7c1ecf6..4b104a16f9 100644 --- a/src/Common/AssemblyCommon.props +++ b/src/Common/AssemblyCommon.props @@ -18,6 +18,11 @@ 3390 + + + + +