diff options
author | Sven Boemer <sbomer@gmail.com> | 2021-11-16 20:05:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 20:05:54 +0300 |
commit | 53c5d48842fe53e05272d163c7f49e54ddcb4b37 (patch) | |
tree | 6a7c5d213af93da5d7dd5adb1c8b10aedcf3f4d4 | |
parent | c90ed0aee46fb24873d95ebaea80a2d11b29a957 (diff) |
Update to 6.0 SDK and use included dotnet-format (#2371)
41 files changed, 95 insertions, 145 deletions
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json deleted file mode 100644 index 5709726d3..000000000 --- a/.config/dotnet-tools.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "dotnet-format": { - "version": "5.0.211103", - "commands": [ - "dotnet-format" - ] - } - } -} diff --git a/.editorconfig b/.editorconfig index ef8a70bec..79b5a9322 100644 --- a/.editorconfig +++ b/.editorconfig @@ -135,6 +135,11 @@ dotnet_diagnostic.CA2201.severity = none # Analyzer crashes with https://github.com/dotnet/roslyn-analyzers/issues/5450 dotnet_diagnostic.CA2252.severity = none +[src/linker/ref/**/*.cs] + +# CA1822: Mark members as static +dotnet_diagnostic.CA1822.severity = none + [external**] dotnet_analyzer_diagnostic.severity = none generated_code = true diff --git a/global.json b/global.json index 868829aa0..80620c636 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "6.0.100-rc.1.21430.12" + "dotnet": "6.0.100" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21559.3", @@ -1,3 +1,2 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "Set-Location %~dp0; & """%~dp0eng\dotnet.ps1""" ""tool restore""" -powershell -ExecutionPolicy ByPass -NoProfile -command "Set-Location %~dp0; & """%~dp0eng\dotnet.ps1""" ""tool run dotnet-format -- illink.sln --fix-whitespace --exclude src/analyzer src/tuner external %*""" +powershell -ExecutionPolicy ByPass -NoProfile -command "Set-Location %~dp0; & """%~dp0eng\dotnet.ps1""" ""format illink.sln --exclude src/analyzer src/tuner external %*""" @@ -13,5 +13,4 @@ while [[ -h $source ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -"$scriptroot/eng/dotnet.sh" tool restore -"$scriptroot/eng/dotnet.sh" tool run dotnet-format -- illink.sln --fix-whitespace --exclude src/analyzer src/tuner external $@ +"$scriptroot/eng/dotnet.sh" format illink.sln --exclude src/analyzer src/tuner external $@ diff --git a/src/ILLink.Shared/DiagnosticString.cs b/src/ILLink.Shared/DiagnosticString.cs index e01cc9b5b..3464ef0a2 100644 --- a/src/ILLink.Shared/DiagnosticString.cs +++ b/src/ILLink.Shared/DiagnosticString.cs @@ -1,6 +1,4 @@ -using System; - -namespace ILLink.Shared +namespace ILLink.Shared { public readonly struct DiagnosticString { diff --git a/src/linker/Linker.Steps/BaseSubStep.cs b/src/linker/Linker.Steps/BaseSubStep.cs index 4826c7014..af991fda9 100644 --- a/src/linker/Linker.Steps/BaseSubStep.cs +++ b/src/linker/Linker.Steps/BaseSubStep.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; using Mono.Cecil; diff --git a/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs b/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs index 8497a61ea..64561aa6b 100644 --- a/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs +++ b/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.Diagnostics; using Mono.Cecil; diff --git a/src/linker/Linker.Steps/DiscoverSerializationHandler.cs b/src/linker/Linker.Steps/DiscoverSerializationHandler.cs index 0b30d6ea4..6ac6da881 100644 --- a/src/linker/Linker.Steps/DiscoverSerializationHandler.cs +++ b/src/linker/Linker.Steps/DiscoverSerializationHandler.cs @@ -2,12 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; using Mono.Cecil; -using Mono.Linker.Dataflow; -using Mono.Linker.Steps; namespace Mono.Linker.Steps { diff --git a/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs b/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs index f97004fd0..8f15014f3 100644 --- a/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs +++ b/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/linker/Linker.Steps/OutputStep.cs b/src/linker/Linker.Steps/OutputStep.cs index b28d52c8d..2fd32880d 100644 --- a/src/linker/Linker.Steps/OutputStep.cs +++ b/src/linker/Linker.Steps/OutputStep.cs @@ -32,7 +32,6 @@ using System.IO; using System.Linq; using System.Runtime.Serialization.Json; using Mono.Cecil; -using Mono.Cecil.Cil; namespace Mono.Linker.Steps { diff --git a/src/linker/Linker.Steps/SubStepsDispatcher.cs b/src/linker/Linker.Steps/SubStepsDispatcher.cs index 3ed5a6e1c..338bbda8b 100644 --- a/src/linker/Linker.Steps/SubStepsDispatcher.cs +++ b/src/linker/Linker.Steps/SubStepsDispatcher.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/linker/Linker/AttributeInfo.cs b/src/linker/Linker/AttributeInfo.cs index 23b31c433..ea430b2de 100644 --- a/src/linker/Linker/AttributeInfo.cs +++ b/src/linker/Linker/AttributeInfo.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Mono.Cecil; namespace Mono.Linker diff --git a/src/linker/Linker/EmbeddedXmlInfo.cs b/src/linker/Linker/EmbeddedXmlInfo.cs index 14871394b..815bbb8d2 100644 --- a/src/linker/Linker/EmbeddedXmlInfo.cs +++ b/src/linker/Linker/EmbeddedXmlInfo.cs @@ -2,10 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.IO; using System.Linq; using System.Xml; -using System.Xml.XPath; using Mono.Cecil; using Mono.Linker.Steps; diff --git a/src/linker/Linker/MemberReferenceExtensions.cs b/src/linker/Linker/MemberReferenceExtensions.cs index b24364aaa..14278fdef 100644 --- a/src/linker/Linker/MemberReferenceExtensions.cs +++ b/src/linker/Linker/MemberReferenceExtensions.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics; +using System.Diagnostics; using System.Text; using Mono.Cecil; diff --git a/src/linker/Linker/MethodDefinitionExtensions.cs b/src/linker/Linker/MethodDefinitionExtensions.cs index 165b75138..d8b370422 100644 --- a/src/linker/Linker/MethodDefinitionExtensions.cs +++ b/src/linker/Linker/MethodDefinitionExtensions.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using Mono.Cecil; namespace Mono.Linker diff --git a/test/ILLink.RoslynAnalyzer.Tests/CompilationExtensions.cs b/test/ILLink.RoslynAnalyzer.Tests/CompilationExtensions.cs index 550a7e8e4..64b3eecbb 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/CompilationExtensions.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/CompilationExtensions.cs @@ -1,14 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Emit; using Xunit; diff --git a/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs b/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs index 7e27f2782..386279369 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using ILLink.Shared; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Xunit; diff --git a/test/ILLink.RoslynAnalyzer.Tests/RequiresUnreferencedCodeAnalyzerTests.cs b/test/ILLink.RoslynAnalyzer.Tests/RequiresUnreferencedCodeAnalyzerTests.cs index b54b65f8e..8a834dd0b 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/RequiresUnreferencedCodeAnalyzerTests.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/RequiresUnreferencedCodeAnalyzerTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using ILLink.RoslynAnalyzer; using ILLink.Shared; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Testing; diff --git a/test/ILLink.RoslynAnalyzer.Tests/TestCase.cs b/test/ILLink.RoslynAnalyzer.Tests/TestCase.cs index 0f35b908a..055da0792 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/TestCase.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/TestCase.cs @@ -1,12 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/test/ILLink.RoslynAnalyzer.Tests/TestCaseCompilation.cs b/test/ILLink.RoslynAnalyzer.Tests/TestCaseCompilation.cs index 4c3db2687..9873c3ac3 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/TestCaseCompilation.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/TestCaseCompilation.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs b/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs index 44881437d..44cdea4a7 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs @@ -12,7 +12,6 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Xunit; @@ -31,7 +30,7 @@ namespace ILLink.RoslynAnalyzer.Tests .WithNuGetConfigFilePath (Path.Combine (TestCaseUtils.GetRepoRoot (), "NuGet.config")); private static ImmutableArray<MetadataReference> s_net6Refs; - public async static ValueTask<ImmutableArray<MetadataReference>> GetNet6References () + public static async ValueTask<ImmutableArray<MetadataReference>> GetNet6References () { if (s_net6Refs.IsDefault) { var refs = await Net6PreviewAssemblies.ResolveAsync (null, default); diff --git a/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs b/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs index 5da895fce..9297b8fc4 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs @@ -63,7 +63,7 @@ namespace ILLink.RoslynAnalyzer.Tests MemberSyntax = memberSyntax; } - bool IsExpectedDiagnostic (AttributeSyntax attribute) + static bool IsExpectedDiagnostic (AttributeSyntax attribute) { switch (attribute.Name.ToString ()) { case "ExpectedWarning": @@ -218,7 +218,7 @@ namespace ILLink.RoslynAnalyzer.Tests } } - missingDiagnosticMessage = $"Could not find text:\n{text}\nIn diagnostics:\n{(string.Join (Environment.NewLine, DiagnosticMessages))}"; + missingDiagnosticMessage = $"Could not find text:\n{text}\nIn diagnostics:\n{string.Join (Environment.NewLine, DiagnosticMessages)}"; return false; } diff --git a/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs b/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs index 26a273aff..3e308104f 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs @@ -2,12 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; -using ILLink.CodeFix; using ILLink.Shared; -using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Xunit; diff --git a/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpAnalyzerVerifier`1.cs b/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpAnalyzerVerifier`1.cs index 5afc179b8..3d26b627d 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpAnalyzerVerifier`1.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpAnalyzerVerifier`1.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; -using System.IO; using System.Linq; using System.Reflection; using System.Text; @@ -10,7 +9,6 @@ using System.Threading; using System.Threading.Tasks; using ILLink.Shared; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; diff --git a/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpCodeFixVerifier`2.cs b/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpCodeFixVerifier`2.cs index 9fc04e38f..fcef098ea 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpCodeFixVerifier`2.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpCodeFixVerifier`2.cs @@ -6,7 +6,6 @@ using System.Threading; using System.Threading.Tasks; using ILLink.Shared; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; diff --git a/test/ILLink.Tasks.Tests/CreateRuntimeRootDescriptorFileTests.cs b/test/ILLink.Tasks.Tests/CreateRuntimeRootDescriptorFileTests.cs index 19d5e6c86..db3bf83f6 100644 --- a/test/ILLink.Tasks.Tests/CreateRuntimeRootDescriptorFileTests.cs +++ b/test/ILLink.Tasks.Tests/CreateRuntimeRootDescriptorFileTests.cs @@ -3,9 +3,7 @@ using System; using System.IO; -using System.Linq; using System.Xml.Linq; -using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xunit; @@ -47,7 +45,7 @@ namespace ILLink.Tasks.Tests File.WriteAllText ("namespace.h", "#define g_TestNS \"TestNS\"" + Environment.NewLine); - File.WriteAllLines ("cortypeinfo.h", new string[] { }); + File.WriteAllLines ("cortypeinfo.h", Array.Empty<string> ()); File.WriteAllLines ("rexcep.h", new string[] { "DEFINE_EXCEPTION(g_TestNS, TestAlwaysException, false, C)", @@ -62,7 +60,7 @@ namespace ILLink.Tasks.Tests XElement existingAssembly = new XElement ("assembly", new XAttribute ("fullname", "testassembly"), new XComment ("Existing content")); XElement existingContent = new XElement ("linker", existingAssembly); - (new XDocument (existingContent)).Save ("Test.ILLink.Descriptors.Combined.xml"); + new XDocument (existingContent).Save ("Test.ILLink.Descriptors.Combined.xml"); var task = new CreateRuntimeRootILLinkDescriptorFile () { NamespaceFilePath = new TaskItem ("namespace.h"), @@ -142,7 +140,7 @@ namespace ILLink.Tasks.Tests File.WriteAllText ("namespace.h", "#define g_TestNS \"TestNS\"" + Environment.NewLine); - File.WriteAllLines ("cortypeinfo.h", new string[] { }); + File.WriteAllLines ("cortypeinfo.h", Array.Empty<string> ()); File.WriteAllLines ("rexcep.h", new string[] { "DEFINE_EXCEPTION(g_TestNS, TestAlwaysException, false, C)", @@ -157,7 +155,7 @@ namespace ILLink.Tasks.Tests XElement existingAssembly = new XElement ("assembly", new XAttribute ("fullname", "testassembly"), new XComment ("Existing content")); XElement existingContent = new XElement ("linker", existingAssembly); - (new XDocument (existingContent)).Save ("Test.ILLink.Descriptors.Combined.xml"); + new XDocument (existingContent).Save ("Test.ILLink.Descriptors.Combined.xml"); var task = new CreateRuntimeRootILLinkDescriptorFile () { NamespaceFilePath = new TaskItem ("namespace.h"), diff --git a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs index 216dec205..e6aef3617 100644 --- a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs +++ b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs @@ -369,7 +369,7 @@ namespace ILLink.Tasks.Tests using (var driver = task.CreateDriver ()) { var actualWarnAsError = driver.Context.WarnAsError; var actualGeneralWarnAsError = driver.Context.GeneralWarnAsError; - Assert.Equal (warnAsError.Count () + warnNotAsError.Count (), actualWarnAsError.Count); + Assert.Equal (warnAsError.Length + warnNotAsError.Length, actualWarnAsError.Count); Assert.Equal (treatWarningsAsErrors, actualGeneralWarnAsError); if (warnAsError.Length > 0) { foreach (var warningCode in warnAsError) @@ -753,7 +753,7 @@ namespace ILLink.Tasks.Tests public void TestErrorHandling () { var task = new MockTask () { - RootAssemblyNames = new ITaskItem[0] + RootAssemblyNames = Array.Empty<ITaskItem> () }; task.BuildEngine = new MockBuildEngine (); Assert.False (task.Execute ()); diff --git a/test/ILLink.Tasks.Tests/Mock.cs b/test/ILLink.Tasks.Tests/Mock.cs index dba28887b..2ea9e492c 100644 --- a/test/ILLink.Tasks.Tests/Mock.cs +++ b/test/ILLink.Tasks.Tests/Mock.cs @@ -21,8 +21,8 @@ namespace ILLink.Tasks.Tests public MockTask () { // Ensure that [Required] members are non-null - AssemblyPaths = new ITaskItem[0]; - RootAssemblyNames = new ITaskItem[0]; + AssemblyPaths = Array.Empty<ITaskItem> (); + RootAssemblyNames = Array.Empty<ITaskItem> (); ILLinkPath = Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "illink.dll"); } diff --git a/test/Mono.Linker.Tests/Extensions/NiceIO.cs b/test/Mono.Linker.Tests/Extensions/NiceIO.cs index 8cbf9c5a5..5fbe8982c 100644 --- a/test/Mono.Linker.Tests/Extensions/NiceIO.cs +++ b/test/Mono.Linker.Tests/Extensions/NiceIO.cs @@ -51,7 +51,7 @@ namespace Mono.Linker.Tests.Extensions if (path == "/") { _isRelative = false; - _elements = new string[] { }; + _elements = Array.Empty<string> (); } else { var split = path.Split ('/', '\\'); @@ -94,7 +94,7 @@ namespace Mono.Linker.Tests.Extensions return stack.Count > 0 && stack[stack.Count - 1] != ".."; } - private string ParseDriveLetter (string path, out string driveLetter) + private static string ParseDriveLetter (string path, out string driveLetter) { if (path.Length >= 2 && path[1] == ':') { driveLetter = path[0].ToString (); @@ -433,7 +433,7 @@ namespace Mono.Linker.Tests.Extensions ThrowIfRelative (); ThrowIfRoot (); EnsureParentDirectoryExists (); - File.WriteAllBytes (ToString (), new byte[0]); + File.WriteAllBytes (ToString (), Array.Empty<byte> ()); return this; } diff --git a/test/Mono.Linker.Tests/TestCases/IndividualTests.cs b/test/Mono.Linker.Tests/TestCases/IndividualTests.cs index a6fb77cad..ca7754f8e 100644 --- a/test/Mono.Linker.Tests/TestCases/IndividualTests.cs +++ b/test/Mono.Linker.Tests/TestCases/IndividualTests.cs @@ -19,7 +19,7 @@ namespace Mono.Linker.Tests.TestCases [TestFixture] public class IndividualTests { - private NPath TestsDirectory => TestDatabase.TestCasesRootDirectory.Parent.Combine ("Mono.Linker.Tests"); + private static NPath TestsDirectory => TestDatabase.TestCasesRootDirectory.Parent.Combine ("Mono.Linker.Tests"); [Test] public void CanSkipUnresolved () @@ -217,14 +217,14 @@ namespace Mono.Linker.Tests.TestCases Assert.That (secondOutputMvid, Is.EqualTo (firstOutputMvid)); } - protected Guid GetMvid (NPath assemblyPath) + protected static Guid GetMvid (NPath assemblyPath) { using (var assembly = AssemblyDefinition.ReadAssembly (assemblyPath)) { return assembly.MainModule.Mvid; } } - private TestCase CreateIndividualCase (Type testCaseType) + private static TestCase CreateIndividualCase (Type testCaseType) { return TestDatabase.CreateCollector ().CreateIndividualCase (testCaseType); } diff --git a/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs b/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs index f4d4b25df..3c9a222be 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs @@ -5,7 +5,6 @@ using System.Linq; using Mono.Cecil; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Extensions; -using NUnit.Framework; namespace Mono.Linker.Tests.TestCasesRunner { diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs b/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs index 949029edc..8915d13fb 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; using System.Text.RegularExpressions; using Mono.Cecil; using Mono.Cecil.Cil; @@ -395,7 +393,7 @@ namespace Mono.Linker.Tests.TestCasesRunner Assert.Fail ($"Invalid test assertion. No member named `{memberName}` exists on the original type `{originalType}`"); } - void VerifyCopyAssemblyIsKeptUnmodified (NPath outputDirectory, string assemblyName) + static void VerifyCopyAssemblyIsKeptUnmodified (NPath outputDirectory, string assemblyName) { string inputAssemblyPath = Path.Combine (Directory.GetParent (outputDirectory).ToString (), "input", assemblyName); string outputAssemblyPath = Path.Combine (outputDirectory, assemblyName); @@ -602,7 +600,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments[0].Value.ToString ()); var expectedReferenceNames = ((CustomAttributeArgument[]) inAssemblyAttribute.ConstructorArguments[1].Value).Select (attr => (string) attr.Value).ToList (); - for (int i = 0; i < expectedReferenceNames.Count (); i++) + for (int i = 0; i < expectedReferenceNames.Count; i++) if (expectedReferenceNames[i].EndsWith (".dll")) expectedReferenceNames[i] = expectedReferenceNames[i].Substring (0, expectedReferenceNames[i].LastIndexOf (".")); @@ -651,12 +649,13 @@ namespace Mono.Linker.Tests.TestCasesRunner } } - bool IsProducedByLinker (CustomAttribute attr) + static bool IsProducedByLinker (CustomAttribute attr) { var producedBy = attr.GetPropertyValue ("ProducedBy"); return producedBy is null ? true : ((ProducedBy) producedBy).HasFlag (ProducedBy.Trimmer); } - IEnumerable<ICustomAttributeProvider> GetAttributeProviders (AssemblyDefinition assembly) + + static IEnumerable<ICustomAttributeProvider> GetAttributeProviders (AssemblyDefinition assembly) { foreach (var testType in assembly.AllDefinedTypes ()) { foreach (var provider in testType.AllMembers ()) @@ -767,8 +766,7 @@ namespace Mono.Linker.Tests.TestCasesRunner return false; } } else if (isCompilerGeneratedCode == true) { - MethodDefinition methodDefinition = mc.Origin?.Provider as MethodDefinition; - if (methodDefinition != null) { + if (mc.Origin?.Provider is MethodDefinition methodDefinition) { if (attrProvider is not IMemberDefinition expectedMember) return false; @@ -946,7 +944,7 @@ namespace Mono.Linker.Tests.TestCasesRunner $"{expectedSourceMember}: Usage of {expectedReflectionMember} unrecognized " + $"{(expectedMessageParts == null ? string.Empty : "and message contains " + string.Join (" ", expectedMessageParts.Select (p => "'" + p + "'")))}"; - Assert.AreEqual (matchedMessages.Count (), matchedPatterns.Count (), + Assert.AreEqual (matchedMessages.Count, matchedPatterns.Count, $"Inconsistency between logged messages and recorded patterns.{Environment.NewLine}{expectedUnrecognizedPatternMessage}{Environment.NewLine}" + $"Matched messages: {Environment.NewLine}{string.Join (Environment.NewLine, matchedMessages.Select (mc => "\t" + mc.Text))}{Environment.NewLine}" + $"Matched unrecognized patterns: {Environment.NewLine}{string.Join (Environment.NewLine, matchedPatterns.Select (p => "\t" + RecognizedReflectionAccessPatternToString (p)))}{Environment.NewLine}"); @@ -1346,7 +1344,7 @@ namespace Mono.Linker.Tests.TestCasesRunner return attr.AttributeType.Resolve ()?.DerivesFrom (nameof (BaseInAssemblyAttribute)) ?? false; } - bool HasAttribute (ICustomAttributeProvider caProvider, string attributeName) + static bool HasAttribute (ICustomAttributeProvider caProvider, string attributeName) { if (caProvider is AssemblyDefinition assembly && assembly.EntryPoint != null) return assembly.EntryPoint.DeclaringType.CustomAttributes diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs index 5d6c8c35a..2607e356e 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs @@ -36,7 +36,7 @@ namespace Mono.Linker.Tests.TestCasesRunner public NPath CompileTestIn (NPath outputDirectory, string outputName, IEnumerable<string> sourceFiles, string[] commonReferences, string[] mainAssemblyReferences, IEnumerable<string> defines, NPath[] resources, string[] additionalArguments) { var originalCommonReferences = commonReferences.Select (r => r.ToNPath ()).ToArray (); - var originalDefines = defines?.ToArray () ?? new string[0]; + var originalDefines = defines?.ToArray () ?? Array.Empty<string> (); Prepare (outputDirectory); @@ -89,8 +89,8 @@ namespace Mono.Linker.Tests.TestCasesRunner protected virtual CompilerOptions CreateOptionsForSupportingAssembly (SetupCompileInfo setupCompileInfo, NPath outputDirectory, NPath[] sourceFiles, NPath[] references, string[] defines, NPath[] resources) { - var allDefines = defines.Concat (setupCompileInfo.Defines ?? new string[0]).ToArray (); - var allReferences = references.Concat (setupCompileInfo.References?.Select (p => MakeSupportingAssemblyReferencePathAbsolute (outputDirectory, p)) ?? new NPath[0]).ToArray (); + var allDefines = defines.Concat (setupCompileInfo.Defines ?? Array.Empty<string> ()).ToArray (); + var allReferences = references.Concat (setupCompileInfo.References?.Select (p => MakeSupportingAssemblyReferencePathAbsolute (outputDirectory, p)) ?? Array.Empty<NPath> ()).ToArray (); string[] additionalArguments = string.IsNullOrEmpty (setupCompileInfo.AdditionalArguments) ? null : new[] { setupCompileInfo.AdditionalArguments }; return new CompilerOptions { OutputPath = outputDirectory.Combine (setupCompileInfo.OutputName), diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs index 404ecbf0f..fdcde52f7 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs @@ -69,7 +69,7 @@ namespace Mono.Linker.Tests.TestCasesRunner if (pos != -1) { string custom_assembly_path = values[0].Substring (pos + 1); if (!Path.IsPathRooted (custom_assembly_path)) - values[0] = values[0].Substring (0, pos + 1) + Path.Combine (inputPath, custom_assembly_path); + values[0] = string.Concat (values[0].AsSpan (0, pos + 1), Path.Combine (inputPath, custom_assembly_path)); } break; case "-a": diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestReflectionPatternRecorder.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestReflectionPatternRecorder.cs index d4b70f1f7..7143952ed 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestReflectionPatternRecorder.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestReflectionPatternRecorder.cs @@ -6,7 +6,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { public class TestReflectionPatternRecorder : IReflectionPatternRecorder { - public IReflectionPatternRecorder PreviousRecorder = null; + public IReflectionPatternRecorder PreviousRecorder; public struct ReflectionAccessPattern { diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs index f6ce178d0..e9ead9713 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs @@ -145,7 +145,7 @@ namespace Mono.Linker.Tests.TestCasesRunner return customizations; } - private T GetResultOfTaskThatMakesNUnitAssertions<T> (Task<T> task) + private static T GetResultOfTaskThatMakesNUnitAssertions<T> (Task<T> task) { try { return task.Result; diff --git a/test/Mono.Linker.Tests/Tests/CecilVersionCheck.cs b/test/Mono.Linker.Tests/Tests/CecilVersionCheck.cs index 78fbbbb81..ca7e43d84 100644 --- a/test/Mono.Linker.Tests/Tests/CecilVersionCheck.cs +++ b/test/Mono.Linker.Tests/Tests/CecilVersionCheck.cs @@ -1,4 +1,3 @@ -using System; using System.Linq; using System.Reflection; using NUnit.Framework; diff --git a/test/Mono.Linker.Tests/Tests/DocumentationSignatureParserTests.cs b/test/Mono.Linker.Tests/Tests/DocumentationSignatureParserTests.cs index 4ea98ba18..19864eb37 100644 --- a/test/Mono.Linker.Tests/Tests/DocumentationSignatureParserTests.cs +++ b/test/Mono.Linker.Tests/Tests/DocumentationSignatureParserTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Mono.Cecil; -using Mono.Linker; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.TestCasesRunner; using NUnit.Framework; @@ -103,32 +102,32 @@ namespace Mono.Linker.Tests [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[])")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[])")] - public void M (int[] a) + public static void M (int[] a) { } [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32,System.Int32,System.Int32)~System.Int32")] - public int M (int a, int b, int c) + public static int M (int a, int b, int c) { return 0; } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MRef(System.Int32@)")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MRef(System.Int32@)")] - public void MRef (ref int a) + public static void MRef (ref int a) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MOut(System.Int32@)")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MOut(System.Int32@)")] - public void MOut (out int a) + public static void MOut (out int a) { a = 5; } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MIn(System.Int32@)")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MIn(System.Int32@)")] - public void MIn (in int a) + public static void MIn (in int a) { } @@ -137,7 +136,7 @@ namespace Mono.Linker.Tests [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MRefReturn")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MRefReturn")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.MRefReturn~System.Int32@")] - public ref int MRefReturn () + public static ref int MRefReturn () { return ref i; } @@ -145,63 +144,63 @@ namespace Mono.Linker.Tests [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M")] [ExpectResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M")] // binds to both. [ExpectResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M()")] // binds to both. - public void M () + public static void M () { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M()")] [ExpectResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M")] [ExpectResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M()")] - public void M (__arglist) + public static void M (__arglist) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[][])")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[][])")] - public void M (int[][] a) + public static void M (int[][] a) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[][0:,0:,0:])")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[][0:,0:,0:])")] - public void M (int[,,][] a) + public static void M (int[,,][] a) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[0:,0:])")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[0:,0:])")] - public void M (int[,] a) + public static void M (int[,] a) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Object)")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Object)")] - public void M (dynamic d) + public static void M (dynamic d) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32*)")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32*)")] - public unsafe void M (int* a) + public static unsafe void M (int* a) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M``1(Mono.Linker.Tests.DocumentationSignatureParserTests.S{Mono.Linker.Tests.DocumentationSignatureParserTests.G{Mono.Linker.Tests.DocumentationSignatureParserTests.A,``0}}**[0:,0:,0:][][][0:,0:]@)")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M``1(Mono.Linker.Tests.DocumentationSignatureParserTests.S{Mono.Linker.Tests.DocumentationSignatureParserTests.G{Mono.Linker.Tests.DocumentationSignatureParserTests.A,``0}}**[0:,0:,0:][][][0:,0:]@)")] - public unsafe void M<T> (ref S<G<A, T>>**[,][][][,,] a) + public static unsafe void M<T> (ref S<G<A, T>>**[,][][][,,] a) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Collections.Generic.List{System.Int32[]})")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Collections.Generic.List{System.Int32[]})")] - public void M (List<int[]> a) + public static void M (List<int[]> a) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32,)")] //[ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32,)")] // there's no way to reference this, since the parsing logic doesn't like it. - public void M (int abo, __arglist) + public static void M (int abo, __arglist) { } @@ -296,7 +295,7 @@ namespace Mono.Linker.Tests { [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.B.Method(Mono.Linker.Tests.DocumentationSignatureParserTests.G{Mono.Linker.Tests.DocumentationSignatureParserTests.A{Mono.Linker.Tests.DocumentationSignatureParserTests.B},System.Collections.Generic.List{Mono.Linker.Tests.DocumentationSignatureParserTests.A}})")] [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.B.Method(Mono.Linker.Tests.DocumentationSignatureParserTests.G{Mono.Linker.Tests.DocumentationSignatureParserTests.A{Mono.Linker.Tests.DocumentationSignatureParserTests.B},System.Collections.Generic.List{Mono.Linker.Tests.DocumentationSignatureParserTests.A}})")] - public void Method (G<A<B>, List<A>> l) + public static void Method (G<A<B>, List<A>> l) { } } @@ -336,44 +335,44 @@ namespace Mono.Linker.Tests [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method")] - public void Method () + public static void Method () { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method(System.Int32)")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method(System.Int32)")] - public void Method (int i) + public static void Method (int i) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.IntMethod")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.IntMethod")] - public int IntMethod () => 0; + public static int IntMethod () => 0; [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method(Mono.Linker.Tests.DocumentationSignatureParserTests.G{Mono.Linker.Tests.DocumentationSignatureParserTests.A,Mono.Linker.Tests.DocumentationSignatureParserTests.A})")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method(Mono.Linker.Tests.DocumentationSignatureParserTests.G{Mono.Linker.Tests.DocumentationSignatureParserTests.A,Mono.Linker.Tests.DocumentationSignatureParserTests.A})")] - public void Method (G<A, A> g) + public static void Method (G<A, A> g) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method(Mono.Linker.Tests.DocumentationSignatureParserTests.G{Mono.Linker.Tests.DocumentationSignatureParserTests.A,Mono.Linker.Tests.DocumentationSignatureParserTests.A}.NG{Mono.Linker.Tests.DocumentationSignatureParserTests.A})")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method(Mono.Linker.Tests.DocumentationSignatureParserTests.G{Mono.Linker.Tests.DocumentationSignatureParserTests.A,Mono.Linker.Tests.DocumentationSignatureParserTests.A}.NG{Mono.Linker.Tests.DocumentationSignatureParserTests.A})")] - public void Method (G<A, A>.NG<A> g) + public static void Method (G<A, A>.NG<A> g) { } public class Invalid { [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoReturnType~")] - public int NoReturnType () => 0; + public static int NoReturnType () => 0; [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoParameters(,)")] - public void NoParameters (int a, int b) + public static void NoParameters (int a, int b) { } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoClosingParen(")] - public void NoClosingParen () { } + public static void NoClosingParen () { } [ExpectUnresolvedDocumentationSignature ("T:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Whitespace ")] [ExpectUnresolvedDocumentationSignature (" T:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Whitespace")] @@ -384,12 +383,12 @@ namespace Mono.Linker.Tests public class Whitespace { [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Whitespace.Method(System.Int32, System.Int32)")] - public void Method (int a, int b) + public static void Method (int a, int b) { } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Whitespace.Method(Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Generic{System.Int32, System.Int32})")] - public void Method (Generic<int, int> g) + public static void Method (Generic<int, int> g) { } } @@ -422,18 +421,18 @@ namespace Mono.Linker.Tests } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.MethodWithGenericInstantiation(Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Generic`1)")] - public void MethodWithGenericInstantiation (Generic<A> g) + public static void MethodWithGenericInstantiation (Generic<A> g) { } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Method(System.Int32[:,:])")] [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Method(System.Int32[0:,)")] - public void Method (int[,] a) + public static void Method (int[,] a) { } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NonGenericMethod(``0)")] - public void NonGenericMethod (int i) + public static void NonGenericMethod (int i) { } @@ -445,7 +444,7 @@ namespace Mono.Linker.Tests } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.MethodMissingArgumentTypeName(System.)")] - public void MethodMissingArgumentTypeName (int i) + public static void MethodMissingArgumentTypeName (int i) { } @@ -453,7 +452,7 @@ namespace Mono.Linker.Tests public class NoType { [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid..Method")] - public void Method () + public static void Method () { } } @@ -466,12 +465,12 @@ namespace Mono.Linker.Tests } [ExpectUnresolvedDocumentationSignature ("T:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoParameterType()")] - public void NoParameterType (int i) + public static void NoParameterType (int i) { } [ExpectUnresolvedDocumentationSignature ("T:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoParameterType(Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Generic{})")] - public void NoGenericParameterType (Generic<A> g) + public static void NoGenericParameterType (Generic<A> g) { } @@ -503,12 +502,12 @@ namespace Mono.Linker.Tests } [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoClosingParenWithParameters(System.Int32")] - public void NoClosingParenWithParameters (int a) + public static void NoClosingParenWithParameters (int a) { } [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoClosingBrace(Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Generic{Mono.Linker.Tests.DocumentationSignatureParserTests.A)")] - public void NoClosingBrace (Generic<A> g) + public static void NoClosingBrace (Generic<A> g) { } diff --git a/test/Mono.Linker.Tests/Tests/GetDisplayNameTests.cs b/test/Mono.Linker.Tests/Tests/GetDisplayNameTests.cs index b025aae92..2b3075850 100644 --- a/test/Mono.Linker.Tests/Tests/GetDisplayNameTests.cs +++ b/test/Mono.Linker.Tests/Tests/GetDisplayNameTests.cs @@ -52,53 +52,53 @@ namespace Mono.Linker.Tests } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.SingleDimensionalArrayTypeParameter(Int32[])")] - public void SingleDimensionalArrayTypeParameter (int[] p) + public static void SingleDimensionalArrayTypeParameter (int[] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.MultiDimensionalArrayTypeParameter(Int32[,])")] - public void MultiDimensionalArrayTypeParameter (int[,] p) + public static void MultiDimensionalArrayTypeParameter (int[,] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.JaggedArrayTypeParameter(Int32[][,])")] - public void JaggedArrayTypeParameter (int[][,] p) + public static void JaggedArrayTypeParameter (int[][,] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.JaggedArrayTypeParameter(Int32[,][])")] - public void JaggedArrayTypeParameter (int[,][] p) + public static void JaggedArrayTypeParameter (int[,][] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.JaggedArrayTypeParameter(Int32[,][,,][,,,])")] - public void JaggedArrayTypeParameter (int[,][,,][,,,] p) + public static void JaggedArrayTypeParameter (int[,][,,][,,,] p) { } // PointerType [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.CommonPointerPointerTypeParameter(Int32*)")] - public unsafe void CommonPointerPointerTypeParameter (int* p) + public static unsafe void CommonPointerPointerTypeParameter (int* p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.PointerToPointerPointerTypeParameter(Int32**)")] - public unsafe void PointerToPointerPointerTypeParameter (int** p) + public static unsafe void PointerToPointerPointerTypeParameter (int** p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.PointerToArrayPointerTypeParameter(Int32*[,,,])")] - public unsafe void PointerToArrayPointerTypeParameter (int*[,,,] p) + public static unsafe void PointerToArrayPointerTypeParameter (int*[,,,] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.PointerToArrayPointerTypeParameter(Int32*[,][,,])")] - public unsafe void PointerToArrayPointerTypeParameter (int*[,][,,] p) + public static unsafe void PointerToArrayPointerTypeParameter (int*[,][,,] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.PointerTypeToUnknownTypeParameter(Void*)")] - public unsafe void PointerTypeToUnknownTypeParameter (void* p) + public static unsafe void PointerTypeToUnknownTypeParameter (void* p) { } } @@ -167,7 +167,7 @@ namespace Mono.Linker.Tests } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.MethodWithNestedGenericTypeArgumentsNoArgumentsOnLeaf(GetDisplayNameTests.GenericClassOneParameter<Int32>.B)")] - public void MethodWithNestedGenericTypeArgumentsNoArgumentsOnLeaf (GenericClassOneParameter<int>.B p) { } + public static void MethodWithNestedGenericTypeArgumentsNoArgumentsOnLeaf (GenericClassOneParameter<int>.B p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.GenericClassMultipleParameters<T,S>")] public class GenericClassMultipleParameters<T, S> @@ -179,24 +179,24 @@ namespace Mono.Linker.Tests } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.MethodWithGenericTypeArgument(IList<GetDisplayNameTests.GenericClassOneParameter<Byte*[]>>)")] - public void MethodWithGenericTypeArgument (IList<GenericClassOneParameter<byte*[]>> p) + public static void MethodWithGenericTypeArgument (IList<GenericClassOneParameter<byte*[]>> p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.MethodWithGenericTypeArguments(GetDisplayNameTests.GenericClassMultipleParameters<Char*[],Int32[,][]>)")] - public void MethodWithGenericTypeArguments (GenericClassMultipleParameters<char*[], int[,][]> p) + public static void MethodWithGenericTypeArguments (GenericClassMultipleParameters<char*[], int[,][]> p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.MethodWithNestedGenericTypeArguments" + "(GetDisplayNameTests.GenericClassMultipleParameters<Char*[],Int32[,][]>.NestedGenericClassMultipleParameters<Char*[],Int32[,][]>)")] - public void MethodWithNestedGenericTypeArguments (GenericClassMultipleParameters<char*[], int[,][]>.NestedGenericClassMultipleParameters<char*[], int[,][]> p) + public static void MethodWithNestedGenericTypeArguments (GenericClassMultipleParameters<char*[], int[,][]>.NestedGenericClassMultipleParameters<char*[], int[,][]> p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.MethodWithPartiallyInstantiatedNestedGenericTypeArguments<MethodT,MethodV>" + "(GetDisplayNameTests.GenericClassMultipleParameters<MethodT,String>.NestedGenericClassMultipleParameters<Int32,MethodV>)")] - public void MethodWithPartiallyInstantiatedNestedGenericTypeArguments<MethodT, MethodV> ( + public static void MethodWithPartiallyInstantiatedNestedGenericTypeArguments<MethodT, MethodV> ( GenericClassMultipleParameters<MethodT, string>.NestedGenericClassMultipleParameters<int, MethodV> p) { } @@ -219,7 +219,7 @@ public class GetDisplayNameTestsGlobalScope public class TypeInGlobalScope { [DisplayName ("GetDisplayNameTestsGlobalScope.TypeInGlobalScope.Method()")] - public void Method () + public static void Method () { } } diff --git a/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs b/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs index e97960359..df06c3ff0 100644 --- a/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs +++ b/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs @@ -106,7 +106,7 @@ b""", new string[] { @"a b" }); } - private void TestParseResponseFileLines (string v1, string[] v2) + private static void TestParseResponseFileLines (string v1, string[] v2) { var result = new Queue<string> (); using (var reader = new StringReader (v1)) |