diff options
44 files changed, 179 insertions, 142 deletions
diff --git a/src/ILLink.Shared/DiagnosticString.cs b/src/ILLink.Shared/DiagnosticString.cs index 3464ef0a2..e01cc9b5b 100644 --- a/src/ILLink.Shared/DiagnosticString.cs +++ b/src/ILLink.Shared/DiagnosticString.cs @@ -1,4 +1,6 @@ -namespace ILLink.Shared +using System; + +namespace ILLink.Shared { public readonly struct DiagnosticString { diff --git a/src/analyzer/ConsoleDependencyGraph.cs b/src/analyzer/ConsoleDependencyGraph.cs index 50a688208..fb2e845ee 100644 --- a/src/analyzer/ConsoleDependencyGraph.cs +++ b/src/analyzer/ConsoleDependencyGraph.cs @@ -96,7 +96,7 @@ namespace LinkerAnalyzer int pi = 0, childIdx; do { - childIdx = childVertex.parentIndexes[pi]; + childIdx = childVertex.parentIndexes [pi]; pi++; } while (visited.Contains (childIdx) && pi < childVertex.parentIndexes.Count); @@ -148,13 +148,13 @@ namespace LinkerAnalyzer Header ("Statistics"); if (verbose) { foreach (var key in counts.Keys) - Console.WriteLine ("Vertex type:\t{0}{1}count:{2}", key, Tabs (key), counts[key]); + Console.WriteLine ("Vertex type:\t{0}{1}count:{2}", key, Tabs (key), counts [key]); } else { - Console.WriteLine ("Assemblies:\t{0}", counts["Assembly"]); - Console.WriteLine ("Modules:\t{0}", counts["Module"]); - Console.WriteLine ("Types:\t\t{0}", counts["TypeDef"]); - Console.WriteLine ("Fields:\t\t{0}", counts["Field"]); - Console.WriteLine ("Methods:\t{0}", counts["Method"]); + Console.WriteLine ("Assemblies:\t{0}", counts ["Assembly"]); + Console.WriteLine ("Modules:\t{0}", counts ["Module"]); + Console.WriteLine ("Types:\t\t{0}", counts ["TypeDef"]); + Console.WriteLine ("Fields:\t\t{0}", counts ["Field"]); + Console.WriteLine ("Methods:\t{0}", counts ["Method"]); } Console.WriteLine (); diff --git a/src/analyzer/LinkerAnalyzerCore/DependencyGraph.cs b/src/analyzer/LinkerAnalyzerCore/DependencyGraph.cs index e4346928b..183c969da 100644 --- a/src/analyzer/LinkerAnalyzerCore/DependencyGraph.cs +++ b/src/analyzer/LinkerAnalyzerCore/DependencyGraph.cs @@ -14,8 +14,7 @@ using System.Xml; namespace LinkerAnalyzer.Core { - public class VertexData - { + public class VertexData { public string value; public List<int> parentIndexes; public int index; @@ -52,8 +51,7 @@ namespace LinkerAnalyzer.Core } } - void Load (GZipStream zipStream) - { + void Load (GZipStream zipStream) { using (XmlReader reader = XmlReader.Create (zipStream)) { while (reader.Read ()) { switch (reader.NodeType) { @@ -90,7 +88,7 @@ namespace LinkerAnalyzer.Core VertexData vertex; try { - vertex = vertices[indexes[vertexName]]; + vertex = vertices [indexes [vertexName]]; } catch (KeyNotFoundException) { if (create) { int index = vertices.Count; @@ -99,9 +97,9 @@ namespace LinkerAnalyzer.Core indexes.Add (vertexName, index); string prefix = vertexName.Substring (0, vertexName.IndexOf (':')); if (counts.ContainsKey (prefix)) - counts[prefix]++; + counts [prefix]++; else - counts[prefix] = 1; + counts [prefix] = 1; //Console.WriteLine ("prefix " + prefix + " count " + counts[prefix]); if (prefix == "TypeDef") { Types.Add (vertex); @@ -115,7 +113,7 @@ namespace LinkerAnalyzer.Core public VertexData Vertex (int index) { - return vertices[index]; + return vertices [index]; } IEnumerable<Tuple<VertexData, int>> AddDependencies (VertexData vertex, HashSet<int> reachedVertices, int depth) diff --git a/src/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs b/src/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs index 74b4ab928..91ee74842 100644 --- a/src/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs +++ b/src/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs @@ -75,7 +75,7 @@ namespace LinkerAnalyzer.Core var key = GetKey (method); if (sizes.ContainsKey (key)) - return sizes[key]; + return sizes [key]; var msize = method.Body.CodeSize; msize += method.Name.Length; @@ -125,7 +125,7 @@ namespace LinkerAnalyzer.Core else Console.Write ("."); - ReaderParameters parameters = new ReaderParameters () { ReadingMode = ReadingMode.Immediate, AssemblyResolver = resolver }; + ReaderParameters parameters = new ReaderParameters () { ReadingMode = ReadingMode.Immediate, AssemblyResolver = resolver}; var assembly = AssemblyDefinition.ReadAssembly (file, parameters); assemblies.Add (assembly); foreach (var module in assembly.Modules) { @@ -146,7 +146,7 @@ namespace LinkerAnalyzer.Core public int GetSize (VertexData vertex) { if (sizes.ContainsKey (vertex.value)) - return sizes[vertex.value]; + return sizes [vertex.value]; return 0; } } diff --git a/src/analyzer/Main.cs b/src/analyzer/Main.cs index 2f70441bc..9e9b31cac 100644 --- a/src/analyzer/Main.cs +++ b/src/analyzer/Main.cs @@ -7,8 +7,8 @@ // Copyright 2015 Xamarin Inc (http://www.xamarin.com). // using System; -using LinkerAnalyzer.Core; using Mono.Options; +using LinkerAnalyzer.Core; namespace LinkerAnalyzer { @@ -56,7 +56,7 @@ namespace LinkerAnalyzer return; } - string dependencyFile = args[args.Length - 1]; + string dependencyFile = args [args.Length - 1]; ConsoleDependencyGraph deps = new ConsoleDependencyGraph () { Tree = reduceToTree, FlatDeps = flatDeps }; deps.Load (dependencyFile); diff --git a/src/linker/Linker.Steps/BaseSubStep.cs b/src/linker/Linker.Steps/BaseSubStep.cs index af991fda9..4826c7014 100644 --- a/src/linker/Linker.Steps/BaseSubStep.cs +++ b/src/linker/Linker.Steps/BaseSubStep.cs @@ -1,6 +1,7 @@ // 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 64561aa6b..8497a61ea 100644 --- a/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs +++ b/src/linker/Linker.Steps/DiscoverCustomOperatorsHandler.cs @@ -1,6 +1,7 @@ // 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 6ac6da881..0b30d6ea4 100644 --- a/src/linker/Linker.Steps/DiscoverSerializationHandler.cs +++ b/src/linker/Linker.Steps/DiscoverSerializationHandler.cs @@ -2,8 +2,12 @@ // 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 8f15014f3..f97004fd0 100644 --- a/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs +++ b/src/linker/Linker.Steps/MarkSubStepsDispatcher.cs @@ -1,6 +1,7 @@ // 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 2fd32880d..b28d52c8d 100644 --- a/src/linker/Linker.Steps/OutputStep.cs +++ b/src/linker/Linker.Steps/OutputStep.cs @@ -32,6 +32,7 @@ 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 338bbda8b..3ed5a6e1c 100644 --- a/src/linker/Linker.Steps/SubStepsDispatcher.cs +++ b/src/linker/Linker.Steps/SubStepsDispatcher.cs @@ -1,6 +1,7 @@ // 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 ea430b2de..23b31c433 100644 --- a/src/linker/Linker/AttributeInfo.cs +++ b/src/linker/Linker/AttributeInfo.cs @@ -3,6 +3,7 @@ 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 815bbb8d2..14871394b 100644 --- a/src/linker/Linker/EmbeddedXmlInfo.cs +++ b/src/linker/Linker/EmbeddedXmlInfo.cs @@ -2,8 +2,10 @@ // 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 14278fdef..b24364aaa 100644 --- a/src/linker/Linker/MemberReferenceExtensions.cs +++ b/src/linker/Linker/MemberReferenceExtensions.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.Text; using Mono.Cecil; diff --git a/src/linker/Linker/MethodDefinitionExtensions.cs b/src/linker/Linker/MethodDefinitionExtensions.cs index d8b370422..165b75138 100644 --- a/src/linker/Linker/MethodDefinitionExtensions.cs +++ b/src/linker/Linker/MethodDefinitionExtensions.cs @@ -1,4 +1,5 @@ -using System.Diagnostics.CodeAnalysis; +using System; +using System.Diagnostics.CodeAnalysis; using Mono.Cecil; namespace Mono.Linker diff --git a/src/linker/ref/Linker.Steps/BaseStep.cs b/src/linker/ref/Linker.Steps/BaseStep.cs index 417d0bf75..53d03bbdd 100644 --- a/src/linker/ref/Linker.Steps/BaseStep.cs +++ b/src/linker/ref/Linker.Steps/BaseStep.cs @@ -8,8 +8,8 @@ namespace Mono.Linker.Steps public abstract class BaseStep : IStep { - public static LinkContext Context { get { throw null; } } - public static AnnotationStore Annotations { get { throw null; } } + public LinkContext Context { get { throw null; } } + public AnnotationStore Annotations { get { throw null; } } public void Process (LinkContext context) { throw null; } protected virtual bool ConditionToProcess () { throw null; } protected virtual void Process () { throw null; } diff --git a/src/linker/ref/Linker.Steps/BaseSubStep.cs b/src/linker/ref/Linker.Steps/BaseSubStep.cs index 9f4f72067..6fa045a1c 100644 --- a/src/linker/ref/Linker.Steps/BaseSubStep.cs +++ b/src/linker/ref/Linker.Steps/BaseSubStep.cs @@ -7,9 +7,9 @@ namespace Mono.Linker.Steps { public abstract class BaseSubStep : ISubStep { - protected static AnnotationStore Annotations { get => throw null; } + protected AnnotationStore Annotations { get => throw null; } - protected static LinkContext Context { get => throw null; } + protected LinkContext Context { get => throw null; } public abstract SubStepTargets Targets { get; } diff --git a/src/linker/ref/Linker.Steps/SubStepsDispatcher.cs b/src/linker/ref/Linker.Steps/SubStepsDispatcher.cs index bf6f7c64a..f6bbbbddd 100644 --- a/src/linker/ref/Linker.Steps/SubStepsDispatcher.cs +++ b/src/linker/ref/Linker.Steps/SubStepsDispatcher.cs @@ -11,7 +11,7 @@ namespace Mono.Linker.Steps protected SubStepsDispatcher (IEnumerable<ISubStep> subSteps) => throw null; - public static void Add (ISubStep substep) => throw null; + public void Add (ISubStep substep) => throw null; void IStep.Process (LinkContext context) => throw null; } diff --git a/src/linker/ref/Linker/Annotations.cs b/src/linker/ref/Linker/Annotations.cs index 69309cb73..4490ffbf4 100644 --- a/src/linker/ref/Linker/Annotations.cs +++ b/src/linker/ref/Linker/Annotations.cs @@ -11,26 +11,26 @@ namespace Mono.Linker { internal AnnotationStore () { } - public static IEnumerable<OverrideInformation> GetOverrides (MethodDefinition method) { throw null; } + public IEnumerable<OverrideInformation> GetOverrides (MethodDefinition method) { throw null; } - public static void Mark (IMetadataTokenProvider provider) { throw null; } - public static void Mark (CustomAttribute attribute) { throw null; } + public void Mark (IMetadataTokenProvider provider) { throw null; } + public void Mark (CustomAttribute attribute) { throw null; } - public static bool IsMarked (IMetadataTokenProvider provider) { throw null; } - public static bool IsMarked (CustomAttribute attribute) { throw null; } + public bool IsMarked (IMetadataTokenProvider provider) { throw null; } + public bool IsMarked (CustomAttribute attribute) { throw null; } - public static void AddPreservedMethod (MethodDefinition key, MethodDefinition method) { throw null; } - public static void AddPreservedMethod (TypeDefinition type, MethodDefinition method) { throw null; } - public static void SetPreserve (TypeDefinition type, TypePreserve preserve) { throw null; } + public void AddPreservedMethod (MethodDefinition key, MethodDefinition method) { throw null; } + public void AddPreservedMethod (TypeDefinition type, MethodDefinition method) { throw null; } + public void SetPreserve (TypeDefinition type, TypePreserve preserve) { throw null; } - public static void SetAction (MethodDefinition method, MethodAction action) { throw null; } - public static void SetStubValue (MethodDefinition method, object value) { throw null; } + public void SetAction (MethodDefinition method, MethodAction action) { throw null; } + public void SetStubValue (MethodDefinition method, object value) { throw null; } - public static AssemblyAction GetAction (AssemblyDefinition assembly) { throw null; } - public static void SetAction (AssemblyDefinition assembly, AssemblyAction action) { throw null; } - public static bool HasAction (AssemblyDefinition assembly) { throw null; } + public AssemblyAction GetAction (AssemblyDefinition assembly) { throw null; } + public void SetAction (AssemblyDefinition assembly, AssemblyAction action) { throw null; } + public bool HasAction (AssemblyDefinition assembly) { throw null; } - public static object GetCustomAnnotation (object key, IMetadataTokenProvider item) { throw null; } - public static void SetCustomAnnotation (object key, IMetadataTokenProvider item, object value) { throw null; } + public object GetCustomAnnotation (object key, IMetadataTokenProvider item) { throw null; } + public void SetCustomAnnotation (object key, IMetadataTokenProvider item, object value) { throw null; } } } diff --git a/src/linker/ref/Linker/LinkContext.cs b/src/linker/ref/Linker/LinkContext.cs index 3a452fd4c..08dc1297e 100644 --- a/src/linker/ref/Linker/LinkContext.cs +++ b/src/linker/ref/Linker/LinkContext.cs @@ -9,25 +9,25 @@ namespace Mono.Linker public class LinkContext : IMetadataResolver { internal LinkContext () { } - public static AnnotationStore Annotations { get { throw null; } } + public AnnotationStore Annotations { get { throw null; } } - public static TypeDefinition GetType (string fullName) { throw null; } - public static string GetAssemblyLocation (AssemblyDefinition assembly) { throw null; } - public static AssemblyDefinition GetLoadedAssembly (string name) { throw null; } + public TypeDefinition GetType (string fullName) { throw null; } + public string GetAssemblyLocation (AssemblyDefinition assembly) { throw null; } + public AssemblyDefinition GetLoadedAssembly (string name) { throw null; } - public static void LogMessage (MessageContainer message) { throw null; } + public void LogMessage (MessageContainer message) { throw null; } - public static bool HasCustomData (string key) { throw null; } - public static bool TryGetCustomData (string key, out string value) { throw null; } + public bool HasCustomData (string key) { throw null; } + public bool TryGetCustomData (string key, out string value) { throw null; } public MethodDefinition Resolve (MethodReference methodReference) { throw null; } public FieldDefinition Resolve (FieldReference fieldReference) { throw null; } public TypeDefinition Resolve (TypeReference typeReference) { throw null; } - public static MethodDefinition TryResolve (MethodReference methodReference) { throw null; } - public static FieldDefinition TryResolve (FieldReference fieldReference) { throw null; } - public static TypeDefinition TryResolve (TypeReference typeReference) { throw null; } + public MethodDefinition TryResolve (MethodReference methodReference) { throw null; } + public FieldDefinition TryResolve (FieldReference fieldReference) { throw null; } + public TypeDefinition TryResolve (TypeReference typeReference) { throw null; } - public static AssemblyDefinition Resolve (AssemblyNameReference nameReference) { throw null; } + public AssemblyDefinition Resolve (AssemblyNameReference nameReference) { throw null; } } } diff --git a/src/linker/ref/Linker/OverrideInformation.cs b/src/linker/ref/Linker/OverrideInformation.cs index 4102b913e..f33e94b71 100644 --- a/src/linker/ref/Linker/OverrideInformation.cs +++ b/src/linker/ref/Linker/OverrideInformation.cs @@ -11,9 +11,9 @@ namespace Mono.Linker { } - public static MethodDefinition Base { get { throw null; } } - public static MethodDefinition Override { get { throw null; } } - public static InterfaceImplementation MatchingInterfaceImplementation { get { throw null; } } - public static TypeDefinition InterfaceType { get { throw null; } } + public MethodDefinition Base { get { throw null; } } + public MethodDefinition Override { get { throw null; } } + public InterfaceImplementation MatchingInterfaceImplementation { get { throw null; } } + public TypeDefinition InterfaceType { get { throw null; } } } } diff --git a/test/ILLink.RoslynAnalyzer.Tests/CompilationExtensions.cs b/test/ILLink.RoslynAnalyzer.Tests/CompilationExtensions.cs index 64b3eecbb..550a7e8e4 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/CompilationExtensions.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/CompilationExtensions.cs @@ -1,11 +1,14 @@ // 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 386279369..7e27f2782 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs @@ -1,8 +1,10 @@ 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/TestCaseCompilation.cs b/test/ILLink.RoslynAnalyzer.Tests/TestCaseCompilation.cs index f2764ef29..edca78bfe 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/TestCaseCompilation.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/TestCaseCompilation.cs @@ -4,7 +4,9 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; 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 eb7c2b4b4..194a1a96b 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs @@ -12,6 +12,7 @@ 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; @@ -30,7 +31,7 @@ namespace ILLink.RoslynAnalyzer.Tests .WithNuGetConfigFilePath (Path.Combine (TestCaseUtils.GetRepoRoot (), "NuGet.config")); private static ImmutableArray<MetadataReference> s_net6Refs; - public static async ValueTask<ImmutableArray<MetadataReference>> GetNet6References () + public async static 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 2bc19c118..56b5c1e72 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs @@ -10,6 +10,7 @@ using System.Text; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Text; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Xunit; @@ -158,7 +159,7 @@ namespace ILLink.RoslynAnalyzer.Tests } } - static bool IsExpectedDiagnostic (AttributeSyntax attribute) + bool IsExpectedDiagnostic (AttributeSyntax attribute) { switch (attribute.Name.ToString ()) { case "ExpectedWarning": @@ -281,7 +282,7 @@ namespace ILLink.RoslynAnalyzer.Tests } } - missingDiagnosticMessage = $"Could not find text:\n{text}\nIn diagnostics:\n{string.Join (Environment.NewLine, _diagnostics)}"; + missingDiagnosticMessage = $"Could not find text:\n{text}\nIn diagnostics:\n{(string.Join (Environment.NewLine, _diagnostics))}"; return false; } diff --git a/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs b/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs index 3e308104f..26a273aff 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs @@ -2,8 +2,12 @@ // 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 37c7ae4f9..79800c3f8 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpAnalyzerVerifier`1.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpAnalyzerVerifier`1.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; +using System.IO; using System.Linq; using System.Reflection; using System.Text; @@ -9,6 +10,7 @@ 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 fcef098ea..9fc04e38f 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpCodeFixVerifier`2.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpCodeFixVerifier`2.cs @@ -6,6 +6,7 @@ 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 db3bf83f6..19d5e6c86 100644 --- a/test/ILLink.Tasks.Tests/CreateRuntimeRootDescriptorFileTests.cs +++ b/test/ILLink.Tasks.Tests/CreateRuntimeRootDescriptorFileTests.cs @@ -3,7 +3,9 @@ using System; using System.IO; +using System.Linq; using System.Xml.Linq; +using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xunit; @@ -45,7 +47,7 @@ namespace ILLink.Tasks.Tests File.WriteAllText ("namespace.h", "#define g_TestNS \"TestNS\"" + Environment.NewLine); - File.WriteAllLines ("cortypeinfo.h", Array.Empty<string> ()); + File.WriteAllLines ("cortypeinfo.h", new string[] { }); File.WriteAllLines ("rexcep.h", new string[] { "DEFINE_EXCEPTION(g_TestNS, TestAlwaysException, false, C)", @@ -60,7 +62,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"), @@ -140,7 +142,7 @@ namespace ILLink.Tasks.Tests File.WriteAllText ("namespace.h", "#define g_TestNS \"TestNS\"" + Environment.NewLine); - File.WriteAllLines ("cortypeinfo.h", Array.Empty<string> ()); + File.WriteAllLines ("cortypeinfo.h", new string[] { }); File.WriteAllLines ("rexcep.h", new string[] { "DEFINE_EXCEPTION(g_TestNS, TestAlwaysException, false, C)", @@ -155,7 +157,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 e6aef3617..216dec205 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.Length + warnNotAsError.Length, actualWarnAsError.Count); + Assert.Equal (warnAsError.Count () + warnNotAsError.Count (), 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 = Array.Empty<ITaskItem> () + RootAssemblyNames = new ITaskItem[0] }; 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 2ea9e492c..dba28887b 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 = Array.Empty<ITaskItem> (); - RootAssemblyNames = Array.Empty<ITaskItem> (); + AssemblyPaths = new ITaskItem[0]; + RootAssemblyNames = new ITaskItem[0]; 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 5fbe8982c..8cbf9c5a5 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 = Array.Empty<string> (); + _elements = new string[] { }; } else { var split = path.Split ('/', '\\'); @@ -94,7 +94,7 @@ namespace Mono.Linker.Tests.Extensions return stack.Count > 0 && stack[stack.Count - 1] != ".."; } - private static string ParseDriveLetter (string path, out string driveLetter) + private 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 (), Array.Empty<byte> ()); + File.WriteAllBytes (ToString (), new byte[0]); return this; } diff --git a/test/Mono.Linker.Tests/TestCases/IndividualTests.cs b/test/Mono.Linker.Tests/TestCases/IndividualTests.cs index ca7754f8e..a6fb77cad 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 static NPath TestsDirectory => TestDatabase.TestCasesRootDirectory.Parent.Combine ("Mono.Linker.Tests"); + private 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 static Guid GetMvid (NPath assemblyPath) + protected Guid GetMvid (NPath assemblyPath) { using (var assembly = AssemblyDefinition.ReadAssembly (assemblyPath)) { return assembly.MainModule.Mvid; } } - private static TestCase CreateIndividualCase (Type testCaseType) + private 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 3c9a222be..f4d4b25df 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs @@ -5,6 +5,7 @@ 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 8915d13fb..949029edc 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs @@ -3,6 +3,8 @@ 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; @@ -393,7 +395,7 @@ namespace Mono.Linker.Tests.TestCasesRunner Assert.Fail ($"Invalid test assertion. No member named `{memberName}` exists on the original type `{originalType}`"); } - static void VerifyCopyAssemblyIsKeptUnmodified (NPath outputDirectory, string assemblyName) + void VerifyCopyAssemblyIsKeptUnmodified (NPath outputDirectory, string assemblyName) { string inputAssemblyPath = Path.Combine (Directory.GetParent (outputDirectory).ToString (), "input", assemblyName); string outputAssemblyPath = Path.Combine (outputDirectory, assemblyName); @@ -600,7 +602,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 (".")); @@ -649,13 +651,12 @@ namespace Mono.Linker.Tests.TestCasesRunner } } - static bool IsProducedByLinker (CustomAttribute attr) + bool IsProducedByLinker (CustomAttribute attr) { var producedBy = attr.GetPropertyValue ("ProducedBy"); return producedBy is null ? true : ((ProducedBy) producedBy).HasFlag (ProducedBy.Trimmer); } - - static IEnumerable<ICustomAttributeProvider> GetAttributeProviders (AssemblyDefinition assembly) + IEnumerable<ICustomAttributeProvider> GetAttributeProviders (AssemblyDefinition assembly) { foreach (var testType in assembly.AllDefinedTypes ()) { foreach (var provider in testType.AllMembers ()) @@ -766,7 +767,8 @@ namespace Mono.Linker.Tests.TestCasesRunner return false; } } else if (isCompilerGeneratedCode == true) { - if (mc.Origin?.Provider is MethodDefinition methodDefinition) { + MethodDefinition methodDefinition = mc.Origin?.Provider as MethodDefinition; + if (methodDefinition != null) { if (attrProvider is not IMemberDefinition expectedMember) return false; @@ -944,7 +946,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}"); @@ -1344,7 +1346,7 @@ namespace Mono.Linker.Tests.TestCasesRunner return attr.AttributeType.Resolve ()?.DerivesFrom (nameof (BaseInAssemblyAttribute)) ?? false; } - static bool HasAttribute (ICustomAttributeProvider caProvider, string attributeName) + 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 2607e356e..5d6c8c35a 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 () ?? Array.Empty<string> (); + var originalDefines = defines?.ToArray () ?? new string[0]; 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 ?? Array.Empty<string> ()).ToArray (); - var allReferences = references.Concat (setupCompileInfo.References?.Select (p => MakeSupportingAssemblyReferencePathAbsolute (outputDirectory, p)) ?? Array.Empty<NPath> ()).ToArray (); + 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 (); 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 fdcde52f7..404ecbf0f 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] = string.Concat (values[0].AsSpan (0, pos + 1), Path.Combine (inputPath, custom_assembly_path)); + values[0] = values[0].Substring (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 7143952ed..d4b70f1f7 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; + public IReflectionPatternRecorder PreviousRecorder = null; public struct ReflectionAccessPattern { diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs index e9ead9713..f6ce178d0 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 static T GetResultOfTaskThatMakesNUnitAssertions<T> (Task<T> task) + private 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 ca7e43d84..78fbbbb81 100644 --- a/test/Mono.Linker.Tests/Tests/CecilVersionCheck.cs +++ b/test/Mono.Linker.Tests/Tests/CecilVersionCheck.cs @@ -1,3 +1,4 @@ +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 19864eb37..4ea98ba18 100644 --- a/test/Mono.Linker.Tests/Tests/DocumentationSignatureParserTests.cs +++ b/test/Mono.Linker.Tests/Tests/DocumentationSignatureParserTests.cs @@ -3,6 +3,7 @@ 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; @@ -102,32 +103,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 static void M (int[] a) + public void M (int[] a) { } [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32,System.Int32,System.Int32)~System.Int32")] - public static int M (int a, int b, int c) + public 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 static void MRef (ref int a) + public 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 static void MOut (out int a) + public 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 static void MIn (in int a) + public void MIn (in int a) { } @@ -136,7 +137,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 static ref int MRefReturn () + public ref int MRefReturn () { return ref i; } @@ -144,63 +145,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 static void M () + public 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 static void M (__arglist) + public void M (__arglist) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[][])")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.A.M(System.Int32[][])")] - public static void M (int[][] a) + public 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 static void M (int[,,][] a) + public 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 static void M (int[,] a) + public 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 static void M (dynamic d) + public 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 static unsafe void M (int* a) + public 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 static unsafe void M<T> (ref S<G<A, T>>**[,][][][,,] a) + public 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 static void M (List<int[]> a) + public 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 static void M (int abo, __arglist) + public void M (int abo, __arglist) { } @@ -295,7 +296,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 static void Method (G<A<B>, List<A>> l) + public void Method (G<A<B>, List<A>> l) { } } @@ -335,44 +336,44 @@ namespace Mono.Linker.Tests [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method")] - public static void Method () + public void Method () { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method(System.Int32)")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Method(System.Int32)")] - public static void Method (int i) + public void Method (int i) { } [ExpectGeneratedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.IntMethod")] [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.IntMethod")] - public static int IntMethod () => 0; + public 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 static void Method (G<A, A> g) + public 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 static void Method (G<A, A>.NG<A> g) + public void Method (G<A, A>.NG<A> g) { } public class Invalid { [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoReturnType~")] - public static int NoReturnType () => 0; + public int NoReturnType () => 0; [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoParameters(,)")] - public static void NoParameters (int a, int b) + public void NoParameters (int a, int b) { } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoClosingParen(")] - public static void NoClosingParen () { } + public void NoClosingParen () { } [ExpectUnresolvedDocumentationSignature ("T:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Whitespace ")] [ExpectUnresolvedDocumentationSignature (" T:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Whitespace")] @@ -383,12 +384,12 @@ namespace Mono.Linker.Tests public class Whitespace { [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Whitespace.Method(System.Int32, System.Int32)")] - public static void Method (int a, int b) + public 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 static void Method (Generic<int, int> g) + public void Method (Generic<int, int> g) { } } @@ -421,18 +422,18 @@ namespace Mono.Linker.Tests } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.MethodWithGenericInstantiation(Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Generic`1)")] - public static void MethodWithGenericInstantiation (Generic<A> g) + public 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 static void Method (int[,] a) + public void Method (int[,] a) { } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NonGenericMethod(``0)")] - public static void NonGenericMethod (int i) + public void NonGenericMethod (int i) { } @@ -444,7 +445,7 @@ namespace Mono.Linker.Tests } [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.MethodMissingArgumentTypeName(System.)")] - public static void MethodMissingArgumentTypeName (int i) + public void MethodMissingArgumentTypeName (int i) { } @@ -452,7 +453,7 @@ namespace Mono.Linker.Tests public class NoType { [ExpectUnresolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid..Method")] - public static void Method () + public void Method () { } } @@ -465,12 +466,12 @@ namespace Mono.Linker.Tests } [ExpectUnresolvedDocumentationSignature ("T:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoParameterType()")] - public static void NoParameterType (int i) + public void NoParameterType (int i) { } [ExpectUnresolvedDocumentationSignature ("T:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoParameterType(Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Generic{})")] - public static void NoGenericParameterType (Generic<A> g) + public void NoGenericParameterType (Generic<A> g) { } @@ -502,12 +503,12 @@ namespace Mono.Linker.Tests } [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoClosingParenWithParameters(System.Int32")] - public static void NoClosingParenWithParameters (int a) + public void NoClosingParenWithParameters (int a) { } [ExpectExactlyResolvedDocumentationSignature ("M:Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.NoClosingBrace(Mono.Linker.Tests.DocumentationSignatureParserTests.Invalid.Generic{Mono.Linker.Tests.DocumentationSignatureParserTests.A)")] - public static void NoClosingBrace (Generic<A> g) + public void NoClosingBrace (Generic<A> g) { } diff --git a/test/Mono.Linker.Tests/Tests/GetDisplayNameTests.cs b/test/Mono.Linker.Tests/Tests/GetDisplayNameTests.cs index 2b3075850..b025aae92 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 static void SingleDimensionalArrayTypeParameter (int[] p) + public void SingleDimensionalArrayTypeParameter (int[] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.MultiDimensionalArrayTypeParameter(Int32[,])")] - public static void MultiDimensionalArrayTypeParameter (int[,] p) + public void MultiDimensionalArrayTypeParameter (int[,] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.JaggedArrayTypeParameter(Int32[][,])")] - public static void JaggedArrayTypeParameter (int[][,] p) + public void JaggedArrayTypeParameter (int[][,] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.JaggedArrayTypeParameter(Int32[,][])")] - public static void JaggedArrayTypeParameter (int[,][] p) + public void JaggedArrayTypeParameter (int[,][] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.JaggedArrayTypeParameter(Int32[,][,,][,,,])")] - public static void JaggedArrayTypeParameter (int[,][,,][,,,] p) + public void JaggedArrayTypeParameter (int[,][,,][,,,] p) { } // PointerType [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.CommonPointerPointerTypeParameter(Int32*)")] - public static unsafe void CommonPointerPointerTypeParameter (int* p) + public unsafe void CommonPointerPointerTypeParameter (int* p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.PointerToPointerPointerTypeParameter(Int32**)")] - public static unsafe void PointerToPointerPointerTypeParameter (int** p) + public unsafe void PointerToPointerPointerTypeParameter (int** p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.PointerToArrayPointerTypeParameter(Int32*[,,,])")] - public static unsafe void PointerToArrayPointerTypeParameter (int*[,,,] p) + public unsafe void PointerToArrayPointerTypeParameter (int*[,,,] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.PointerToArrayPointerTypeParameter(Int32*[,][,,])")] - public static unsafe void PointerToArrayPointerTypeParameter (int*[,][,,] p) + public unsafe void PointerToArrayPointerTypeParameter (int*[,][,,] p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.A.PointerTypeToUnknownTypeParameter(Void*)")] - public static unsafe void PointerTypeToUnknownTypeParameter (void* p) + public unsafe void PointerTypeToUnknownTypeParameter (void* p) { } } @@ -167,7 +167,7 @@ namespace Mono.Linker.Tests } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.MethodWithNestedGenericTypeArgumentsNoArgumentsOnLeaf(GetDisplayNameTests.GenericClassOneParameter<Int32>.B)")] - public static void MethodWithNestedGenericTypeArgumentsNoArgumentsOnLeaf (GenericClassOneParameter<int>.B p) { } + public 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 static void MethodWithGenericTypeArgument (IList<GenericClassOneParameter<byte*[]>> p) + public void MethodWithGenericTypeArgument (IList<GenericClassOneParameter<byte*[]>> p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.MethodWithGenericTypeArguments(GetDisplayNameTests.GenericClassMultipleParameters<Char*[],Int32[,][]>)")] - public static void MethodWithGenericTypeArguments (GenericClassMultipleParameters<char*[], int[,][]> p) + public void MethodWithGenericTypeArguments (GenericClassMultipleParameters<char*[], int[,][]> p) { } [DisplayName ("Mono.Linker.Tests.GetDisplayNameTests.MethodWithNestedGenericTypeArguments" + "(GetDisplayNameTests.GenericClassMultipleParameters<Char*[],Int32[,][]>.NestedGenericClassMultipleParameters<Char*[],Int32[,][]>)")] - public static void MethodWithNestedGenericTypeArguments (GenericClassMultipleParameters<char*[], int[,][]>.NestedGenericClassMultipleParameters<char*[], int[,][]> p) + public 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 static void MethodWithPartiallyInstantiatedNestedGenericTypeArguments<MethodT, MethodV> ( + public 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 static void Method () + public void Method () { } } diff --git a/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs b/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs index df06c3ff0..e97960359 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 static void TestParseResponseFileLines (string v1, string[] v2) + private void TestParseResponseFileLines (string v1, string[] v2) { var result = new Queue<string> (); using (var reader = new StringReader (v1)) |