Add NotAccessibleFieldTypeInGeneratedShaderDescriptorAttributeTargetAnalyzerBase

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-19 13:59:06 +02:00
1 親 ba80b6aa01
コミット 5b971b1b3d
10ファイル変更
+178 -3

検索条件に一致するファイルはありません

+1
ファイルの表示
@@ -61,3 +61,4 @@ CMPS0052 | ComputeSharp.Shaders | Error | [Documentation](https://github.com/Ser
CMPS0053 | ComputeSharp.Shaders | Warning | [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPS0054 | ComputeSharp.Shaders | Error | [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPS0055 | ComputeSharp.Shaders | Error | [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPS0056 | ComputeSharp.Shaders | Error | [Documentation](https://github.com/Sergio0694/ComputeSharp)
@@ -0,0 +1,19 @@
using ComputeSharp.SourceGeneration.Diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors;
namespace ComputeSharp.SourceGenerators;
/// <inheritdoc/>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public sealed class NotAccessibleFieldTypeInGeneratedShaderDescriptorAttributeTargetAnalyzer : NotAccessibleFieldTypeInGeneratedShaderDescriptorAttributeTargetAnalyzerBase
{
/// <summary>
/// Creates a new <see cref="NotAccessibleFieldTypeInGeneratedShaderDescriptorAttributeTargetAnalyzer"/> instance.
/// </summary>
public NotAccessibleFieldTypeInGeneratedShaderDescriptorAttributeTargetAnalyzer()
: base(NotAccessibleFieldTypeInTargetTypeForGeneratedComputeShaderDescriptorAttribute, "ComputeSharp.GeneratedComputeShaderDescriptorAttribute")
{
}
}
+16
ファイルの表示
@@ -784,4 +784,20 @@ partial class DiagnosticDescriptors
isEnabledByDefault: true,
description: "The [GeneratedComputeShaderDescriptor] attribute requires target types to be accessible from their containing assembly.",
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
/// <summary>
/// Gets a <see cref="DiagnosticDescriptor"/> for when a field in a type using the <c>[GeneratedComputeShaderDescriptor]</c> attribute has a type that is not accessible from its containing assembly.
/// <para>
/// Format: <c>"The [GeneratedComputeShaderDescriptor] attribute requires the type of all fields of target types to be accessible from their containing assembly (type {0} has a field "{1}" of type {2} that has less effective accessibility than internal)"</c>.
/// </para>
/// </summary>
public static readonly DiagnosticDescriptor NotAccessibleFieldTypeInTargetTypeForGeneratedComputeShaderDescriptorAttribute = new DiagnosticDescriptor(
id: "CMPS0056",
title: "Invalid [GeneratedComputeShaderDescriptor] attribute target",
messageFormat: """The [GeneratedComputeShaderDescriptor] attribute requires the type of all fields of target types to be accessible from their containing assembly (type {0} has a field "{1}" of type {2} that has less effective accessibility than internal)""",
category: "ComputeSharp.Shaders",
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: "The [GeneratedComputeShaderDescriptor] attribute requires the type of all fields of target types to be accessible from their containing assembly.",
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
}