Apply IDE0090 (Use 'new(...)') on Microsoft.CodeAnalysis.Testing
This commit is contained in:
Родитель
7ad7d8554f
Коммит
f7f578c52a
|
@ -30,7 +30,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
/// </summary>
|
||||
private static readonly PropertyInfo AttributeUsageAllowMultipleProperty = typeof(AttributeUsageAttribute).GetProperty(nameof(AttributeUsageAttribute.AllowMultiple))!;
|
||||
|
||||
private static readonly object s_codeGenerationLock = new object();
|
||||
private static readonly object s_codeGenerationLock = new();
|
||||
private static Type? s_generatedAnalysisContextType;
|
||||
|
||||
public static bool HasConfiguredGeneratedCodeAnalysis(DiagnosticAnalyzer analyzer)
|
||||
|
|
|
@ -171,7 +171,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
/// </summary>
|
||||
protected TimeSpan MatchDiagnosticsTimeout { get; set; } = TimeSpan.FromSeconds(2);
|
||||
|
||||
private readonly ConcurrentBag<Workspace> _workspaces = new ConcurrentBag<Workspace>();
|
||||
private readonly ConcurrentBag<Workspace> _workspaces = new();
|
||||
|
||||
/// <summary>
|
||||
/// Runs the test.
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
/// </summary>
|
||||
/// <param name="descriptor">The diagnostic descriptor.</param>
|
||||
/// <returns>A <see cref="DiagnosticResult"/> initialed using the specified <paramref name="descriptor"/>.</returns>
|
||||
public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor) => new DiagnosticResult(descriptor);
|
||||
public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor) => new(descriptor);
|
||||
|
||||
/// <summary>
|
||||
/// Verifies the analyzer produces the specified diagnostics for the given source text.
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
/// <param name="identifier">The compiler error ID.</param>
|
||||
/// <returns>A <see cref="DiagnosticResult"/> for a compiler error with the specified ID.</returns>
|
||||
public static DiagnosticResult CompilerError(string identifier)
|
||||
=> new DiagnosticResult(identifier, DiagnosticSeverity.Error);
|
||||
=> new(identifier, DiagnosticSeverity.Error);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="DiagnosticResult"/> for a compiler warning with the specified ID.
|
||||
|
@ -180,7 +180,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
/// <param name="identifier">The compiler warning ID.</param>
|
||||
/// <returns>A <see cref="DiagnosticResult"/> for a compiler warning with the specified ID.</returns>
|
||||
public static DiagnosticResult CompilerWarning(string identifier)
|
||||
=> new DiagnosticResult(identifier, DiagnosticSeverity.Warning);
|
||||
=> new(identifier, DiagnosticSeverity.Warning);
|
||||
|
||||
/// <summary>
|
||||
/// Transforms the current <see cref="DiagnosticResult"/> to have the specified <see cref="Severity"/>.
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
{
|
||||
private static readonly IChunker s_lineChunker = new LineChunker();
|
||||
private static readonly IChunker s_lineEndingsPreservingChunker = new LineEndingsPreservingChunker();
|
||||
private static readonly InlineDiffBuilder s_diffBuilder = new InlineDiffBuilder(new Differ());
|
||||
private static readonly InlineDiffBuilder s_diffBuilder = new(new Differ());
|
||||
|
||||
/// <summary>
|
||||
/// Asserts that two strings are equal, and prints a diff between the two if they are not.
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
public class MetadataReferenceCollection : List<MetadataReference>
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, MetadataReference> s_referencesFromFiles =
|
||||
new ConcurrentDictionary<string, MetadataReference>();
|
||||
new();
|
||||
|
||||
public void Add(Assembly assembly)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
{
|
||||
private const string ReferenceAssembliesPackageVersion = "1.0.2";
|
||||
|
||||
private static readonly FileSystemSemaphore Semaphore = new FileSystemSemaphore(Path.Combine(Path.GetTempPath(), "test-packages", ".lock"));
|
||||
private static readonly FileSystemSemaphore Semaphore = new(Path.Combine(Path.GetTempPath(), "test-packages", ".lock"));
|
||||
|
||||
private static ImmutableDictionary<NuGet.Packaging.Core.PackageIdentity, string> s_packageToInstalledLocation
|
||||
= ImmutableDictionary.Create<NuGet.Packaging.Core.PackageIdentity, string>(PackageIdentityComparer.Default);
|
||||
|
@ -38,7 +38,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
= ImmutableHashSet.Create<NuGet.Packaging.Core.PackageIdentity>(PackageIdentityComparer.Default);
|
||||
|
||||
private readonly Dictionary<string, ImmutableArray<MetadataReference>> _references
|
||||
= new Dictionary<string, ImmutableArray<MetadataReference>>();
|
||||
= new();
|
||||
|
||||
public ReferenceAssemblies(string targetFramework)
|
||||
{
|
||||
|
@ -124,13 +124,13 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
public string? NuGetConfigFilePath { get; }
|
||||
|
||||
public ReferenceAssemblies WithAssemblyIdentityComparer(AssemblyIdentityComparer assemblyIdentityComparer)
|
||||
=> new ReferenceAssemblies(TargetFramework, assemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, FacadeAssemblies, LanguageSpecificAssemblies, Packages, NuGetConfigFilePath);
|
||||
=> new(TargetFramework, assemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, FacadeAssemblies, LanguageSpecificAssemblies, Packages, NuGetConfigFilePath);
|
||||
|
||||
public ReferenceAssemblies WithAssemblies(ImmutableArray<string> assemblies)
|
||||
=> new ReferenceAssemblies(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, assemblies, FacadeAssemblies, LanguageSpecificAssemblies, Packages, NuGetConfigFilePath);
|
||||
=> new(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, assemblies, FacadeAssemblies, LanguageSpecificAssemblies, Packages, NuGetConfigFilePath);
|
||||
|
||||
public ReferenceAssemblies WithFacadeAssemblies(ImmutableArray<string> facadeAssemblies)
|
||||
=> new ReferenceAssemblies(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, facadeAssemblies, LanguageSpecificAssemblies, Packages, NuGetConfigFilePath);
|
||||
=> new(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, facadeAssemblies, LanguageSpecificAssemblies, Packages, NuGetConfigFilePath);
|
||||
|
||||
public ReferenceAssemblies AddAssemblies(ImmutableArray<string> assemblies)
|
||||
=> WithAssemblies(Assemblies.AddRange(assemblies));
|
||||
|
@ -139,7 +139,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
=> WithFacadeAssemblies(FacadeAssemblies.AddRange(facadeAssemblies));
|
||||
|
||||
public ReferenceAssemblies WithLanguageSpecificAssemblies(ImmutableDictionary<string, ImmutableArray<string>> languageSpecificAssemblies)
|
||||
=> new ReferenceAssemblies(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, FacadeAssemblies, languageSpecificAssemblies, Packages, NuGetConfigFilePath);
|
||||
=> new(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, FacadeAssemblies, languageSpecificAssemblies, Packages, NuGetConfigFilePath);
|
||||
|
||||
public ReferenceAssemblies WithLanguageSpecificAssemblies(string language, ImmutableArray<string> assemblies)
|
||||
=> WithLanguageSpecificAssemblies(LanguageSpecificAssemblies.SetItem(language, assemblies));
|
||||
|
@ -155,13 +155,13 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
}
|
||||
|
||||
public ReferenceAssemblies WithPackages(ImmutableArray<PackageIdentity> packages)
|
||||
=> new ReferenceAssemblies(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, FacadeAssemblies, LanguageSpecificAssemblies, packages, NuGetConfigFilePath);
|
||||
=> new(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, FacadeAssemblies, LanguageSpecificAssemblies, packages, NuGetConfigFilePath);
|
||||
|
||||
public ReferenceAssemblies AddPackages(ImmutableArray<PackageIdentity> packages)
|
||||
=> WithPackages(Packages.AddRange(packages));
|
||||
|
||||
public ReferenceAssemblies WithNuGetConfigFilePath(string nugetConfigFilePath)
|
||||
=> new ReferenceAssemblies(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, FacadeAssemblies, LanguageSpecificAssemblies, Packages, nugetConfigFilePath);
|
||||
=> new(TargetFramework, AssemblyIdentityComparer, ReferenceAssemblyPackage, ReferenceAssemblyPath, Assemblies, FacadeAssemblies, LanguageSpecificAssemblies, Packages, nugetConfigFilePath);
|
||||
|
||||
public async Task<ImmutableArray<MetadataReference>> ResolveAsync(string? language, CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -897,7 +897,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
public static class Net
|
||||
{
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet50 =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
{
|
||||
if (!NuGetFramework.Parse("net5.0").IsPackageBased)
|
||||
{
|
||||
|
@ -914,7 +914,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
});
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet60 =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
{
|
||||
if (!NuGetFramework.Parse("net6.0").IsPackageBased)
|
||||
{
|
||||
|
@ -931,43 +931,43 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
});
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet60Windows =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net60.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.WindowsDesktop.App.Ref", "6.0.0"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet60Android =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net60.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.Android.Ref", "31.0.100-rc.1.12"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet60iOS =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net60.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.iOS.Ref", "16.0.527"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet60MacOS =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net60.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.macOS.Ref", "12.3.471"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet60MacCatalyst =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net60.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.MacCatalyst.Ref", "15.4.471"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet60TvOS =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net60.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.tvOS.Ref", "16.0.527"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet70 =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
{
|
||||
if (!NuGetFramework.Parse("net7.0").IsPackageBased)
|
||||
{
|
||||
|
@ -984,31 +984,31 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
});
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet70Windows =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net70.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.WindowsDesktop.App.Ref", "7.0.0"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet70MacOS =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net70.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.macOS.Ref", "12.3.2372"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet70iOS =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net70.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.iOS.Ref", "16.0.1478"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet70MacCatalyst =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net70.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.MacCatalyst.Ref", "15.4.2372"))));
|
||||
|
||||
private static readonly Lazy<ReferenceAssemblies> _lazyNet70TvOS =
|
||||
new Lazy<ReferenceAssemblies>(() =>
|
||||
new(() =>
|
||||
Net70.AddPackages(
|
||||
ImmutableArray.Create(
|
||||
new PackageIdentity("Microsoft.tvOS.Ref", "16.0.1478"))));
|
||||
|
|
|
@ -53,11 +53,11 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private const string NamedSpanEndString = "|}";
|
||||
private const string NamedSpanNumberedEndString = "|#";
|
||||
|
||||
private static readonly Regex s_namedSpanStartRegex = new Regex(
|
||||
private static readonly Regex s_namedSpanStartRegex = new(
|
||||
@"\{\| ([^:|[\]{}]+) \:",
|
||||
RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
private static readonly Regex s_namedSpanEndRegex = new Regex(
|
||||
private static readonly Regex s_namedSpanEndRegex = new(
|
||||
@"\| (\#\d+) \}",
|
||||
RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>New <see cref="CodeFixContext"/>.</returns>
|
||||
protected virtual CodeFixContext CreateCodeFixContext(Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, CancellationToken cancellationToken)
|
||||
=> new CodeFixContext(document, span, diagnostics, registerCodeFix, cancellationToken);
|
||||
=> new(document, span, diagnostics, registerCodeFix, cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="FixAllContext"/>.
|
||||
|
|
|
@ -29,6 +29,6 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
public override Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken)
|
||||
=> Task.FromResult(_diagnostics.Where(i => !i.diagnostic.Location.IsInSource).Where(diagnostic => diagnostic.project.Id == project.Id).Select(diagnostic => diagnostic.diagnostic));
|
||||
|
||||
internal static TestDiagnosticProvider Create(ImmutableArray<(Project project, Diagnostic diagnostic)> diagnostics) => new TestDiagnosticProvider(diagnostics);
|
||||
internal static TestDiagnosticProvider Create(ImmutableArray<(Project project, Diagnostic diagnostic)> diagnostics) => new(diagnostics);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>New <see cref="CodeRefactoringContext"/>.</returns>
|
||||
protected virtual CodeRefactoringContext CreateCodeRefactoringContext(Document document, TextSpan span, Action<CodeAction> registerRefactoring, CancellationToken cancellationToken)
|
||||
=> new CodeRefactoringContext(document, span, registerRefactoring, cancellationToken);
|
||||
=> new(document, span, registerRefactoring, cancellationToken);
|
||||
|
||||
protected override async Task RunImplAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
internal class HighlightBracesIfAnalyzerConfigMissingAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor);
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class ReplaceThisWithBaseAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("ThisToBase", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("ThisToBase", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
private readonly GeneratedCodeAnalysisFlags? _generatedCodeAnalysisFlags;
|
||||
|
||||
|
@ -288,7 +288,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class NotConfigurableReplaceThisWithBaseAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("ThisToBase", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true, customTags: new[] { WellKnownDiagnosticTags.NotConfigurable });
|
||||
new("ThisToBase", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true, customTags: new[] { WellKnownDiagnosticTags.NotConfigurable });
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor);
|
||||
|
||||
|
@ -318,7 +318,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class FirstLineDiagnosticAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("FirstLine", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("FirstLine", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor);
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class ReportCompilationDiagnosticAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor);
|
||||
|
||||
|
|
|
@ -127,8 +127,8 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
private class TwoDescriptorAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor1 = new DiagnosticDescriptor("ID", "title", "first message format", "category", DiagnosticSeverity.Info, isEnabledByDefault: true);
|
||||
internal static readonly DiagnosticDescriptor Descriptor2 = new DiagnosticDescriptor("ID", "title", "second message format", "category", DiagnosticSeverity.Info, isEnabledByDefault: true);
|
||||
internal static readonly DiagnosticDescriptor Descriptor1 = new("ID", "title", "first message format", "category", DiagnosticSeverity.Info, isEnabledByDefault: true);
|
||||
internal static readonly DiagnosticDescriptor Descriptor2 = new("ID", "title", "second message format", "category", DiagnosticSeverity.Info, isEnabledByDefault: true);
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }
|
||||
= ImmutableArray.Create(Descriptor1, Descriptor2);
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
internal class HighlightBracesSuppressor : DiagnosticSuppressor
|
||||
{
|
||||
internal static readonly SuppressionDescriptor Descriptor =
|
||||
new SuppressionDescriptor("XBrace", DiagnosticDescriptor.Id, "justification");
|
||||
new("XBrace", DiagnosticDescriptor.Id, "justification");
|
||||
|
||||
public override ImmutableArray<SuppressionDescriptor> SupportedSuppressions => ImmutableArray.Create(Descriptor);
|
||||
|
||||
|
|
|
@ -225,16 +225,16 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class HighlightBracesAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor DescriptorOuter =
|
||||
new DiagnosticDescriptor("BraceOuter", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("BraceOuter", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
internal static readonly DiagnosticDescriptor DescriptorOuterHidden =
|
||||
new DiagnosticDescriptor("BraceOuter", "title", "message", "category", DiagnosticSeverity.Hidden, isEnabledByDefault: true);
|
||||
new("BraceOuter", "title", "message", "category", DiagnosticSeverity.Hidden, isEnabledByDefault: true);
|
||||
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
internal static readonly DiagnosticDescriptor DescriptorHidden =
|
||||
new DiagnosticDescriptor("Brace", "title", "message", "category", DiagnosticSeverity.Hidden, isEnabledByDefault: true);
|
||||
new("Brace", "title", "message", "category", DiagnosticSeverity.Hidden, isEnabledByDefault: true);
|
||||
|
||||
private readonly bool _nestedDiagnostics;
|
||||
private readonly bool _hiddenDescriptors;
|
||||
|
|
|
@ -284,7 +284,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class HighlightBracesAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
private readonly SuppressDiagnosticIf _suppressDiagnosticIf;
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class HighlightBracesAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("Brace", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
private readonly SuppressDiagnosticIf _suppressDiagnosticIf;
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class ReplaceThisWithBaseAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("ThisToBase", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("ThisToBase", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor);
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ namespace Microsoft.CodeAnalysis.Testing
|
|||
private class LiteralZeroAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("LiteralZero", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("LiteralZero", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Microsoft.CodeAnalysis.Testing.TestAnalyzers
|
|||
internal const string CurrentValueProperty = nameof(CurrentValueProperty);
|
||||
|
||||
internal static readonly DiagnosticDescriptor Descriptor =
|
||||
new DiagnosticDescriptor("LiteralUnderFive", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
new("LiteralUnderFive", "title", "message", "category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.Testing.TestGenerators
|
|||
{
|
||||
public class AddEmptyFileWithDiagnostic : AddEmptyFile
|
||||
{
|
||||
public static readonly DiagnosticDescriptor Descriptor = new DiagnosticDescriptor(
|
||||
public static readonly DiagnosticDescriptor Descriptor = new(
|
||||
"SG0001",
|
||||
"Title",
|
||||
"Message",
|
||||
|
|
Загрузка…
Ссылка в новой задаче