From 986cd80f8e2e2d95ada4cc61f2adb4b65364651e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 30 Dec 2023 23:19:25 +0100 Subject: [PATCH] Rename InvalidD2DResourceTextureIndexUseAnalyzer --- ...idD2DResourceTextureIndexAttributeLocationAnalyzer.cs} | 8 ++++---- .../Diagnostics/DiagnosticDescriptors.cs | 8 ++++---- .../Test_D2DPixelShaderDescriptorGenerator.cs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) rename src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/{InvalidD2DResourceTextureIndexUseAnalyzer.cs => InvalidD2DResourceTextureIndexAttributeLocationAnalyzer.cs} (94%) diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexAttributeLocationAnalyzer.cs similarity index 94% rename from src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs rename to src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexAttributeLocationAnalyzer.cs index fc924003..09f99388 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexAttributeLocationAnalyzer.cs @@ -8,13 +8,13 @@ using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors; namespace ComputeSharp.D2D1.SourceGenerators; /// -/// A diagnostic analyzer that generates an error whenever [D2DResourceTextureIndex] is used incorrectly to annotate an invalid field. +/// A diagnostic analyzer that generates an error whenever [D2DResourceTextureIndex] is used incorrectly to annotate a field. /// [DiagnosticAnalyzer(LanguageNames.CSharp)] -public sealed class InvalidD2DResourceTextureIndexUseAnalyzer : DiagnosticAnalyzer +public sealed class InvalidD2DResourceTextureIndexAttributeLocationAnalyzer : DiagnosticAnalyzer { /// - public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2DResourceTextureIndexAttributeUse); + public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2DResourceTextureIndexAttributeLocation); /// public override void Initialize(AnalysisContext context) @@ -49,7 +49,7 @@ public sealed class InvalidD2DResourceTextureIndexUseAnalyzer : DiagnosticAnalyz SymbolEqualityComparer.Default.Equals(typeSymbol.ConstructedFrom, d2D1ResourceTexture3DSymbol))) { Diagnostic diagnostic = Diagnostic.Create( - InvalidD2DResourceTextureIndexAttributeUse, + InvalidD2DResourceTextureIndexAttributeLocation, fieldSymbol.Locations.First(), fieldSymbol.Name, fieldSymbol.ContainingType, diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs index aa16d774..92e52829 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs @@ -702,14 +702,14 @@ partial class DiagnosticDescriptors helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); /// - /// Gets a for an invalid use of [D2DResourceTextureIndex]. + /// Gets a for an invalid location of [D2DResourceTextureIndex]. /// - /// Format: "The field "{0}" (in type {1}) is using [D2DResourceTextureIndex] incorrectly (the attribute can only be used on D2D1 resource texture types, but the field is of type {2})". + /// Format: "The field "{0}" (in type {1}) is using [D2DResourceTextureIndex] on an invalid location (the attribute can only be used on D2D1 resource texture types, but the field is of type {2})". /// /// - public static readonly DiagnosticDescriptor InvalidD2DResourceTextureIndexAttributeUse = new( + public static readonly DiagnosticDescriptor InvalidD2DResourceTextureIndexAttributeLocation = new( id: "CMPSD2D0049", - title: "Invalid [D2DResourceTextureIndex] use", + title: "Invalid [D2DResourceTextureIndex] location", messageFormat: """The field "{0}" (in type {1}) is using [D2DResourceTextureIndex] incorrectly (the attribute can only be used on D2D1 resource texture types, but the field is of type {2})""", category: "ComputeSharp.D2D1.Shaders", defaultSeverity: DiagnosticSeverity.Error, diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs index e9ce7e4a..25eea0d8 100644 --- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs +++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs @@ -1770,7 +1770,7 @@ public class Test_D2DPixelShaderDescriptorGenerator await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); - await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); + await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source);